L1- Functions of an operating system (Chapter 7)

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

What does the OS do?

The OS manages the hardware and provides an interface for the user and the application software

2
New cards

Memory management- paging

-A page is a fixed-sized division of physical memory.

-Memory manager gives each page a number and records the location in a ‘page table’.

-A process currently in use may be held in non-contiguous pages.

-A page table uses mapping to store a link between the physical memory address and the logical address space of each process.

3
New cards

Memory management- segmentation

-Segments are differently-sized complete logical sections of programs

-They are logical divisions

-E.g., if there are two free spaces but a program is too big to fit all of it in either space then the program will be split up LOGICALLY so a subroutine could be stored in one free space and the main program is stored in the other space

-WHEREAS, if it were paging, the program would fill up the first free space and then the rest of the program would be stored in the remaining free space.

4
New cards

Memory management- virtual memory

-When the RAM runs out of space, programs that aren’t being used currently are moved to the virtual memory on the hard disk.

-When the programs are needed again, they can be swapped out for another program in the main memory.

-However, the disadvantage of using virtual memory is that it is slower since fetching programs from virtual memory takes longer than fetching from RAM.

5
New cards

What is an interrupt?

An interrupt is a way for other devices and applications to signal to the processor that they require attention during a FDE cycle- they always have higher priority than normal programs.

6
New cards

Interrupt Service Routine

-When there is an interrupt, the processor needs to stop executing its current program to run code for the interrupt so there is an interrupt service routine (a program with a set of instructions that need to be fetched, decoded, and executed to carry out operations of the interrupt).

-When an interrupt is received, the values held in the registers (PC, MAR, MDR, CIR, ACC) are pushed onto a stack in a stack frame, saving them for later retrieval.

-The interrupt is executed.

-Once the interrupt is complete, the frame is popped off the top of the stack and the processor carries on executing the original program.

-IF an interrupt is interrupted, the interrupt service routine is suspended, its registers’ contents are pushed onto a stack and the second interrupt service routine is executed.

-Interrupt examples: screen recording application, power supply failure, etc.

7
New cards

Peripheral Management

-The OS has software called device drivers which enables it to control and interact with peripheral devices e.g., printers, graphics cards, network cards, etc.

-Many external devices have embedded system software, so a driver bridges the gap between a major operating system and a tiny hardware OS.

-Device drivers allow the OS to perform specific operations on the hardware e.g. a printer driver enables the OS to send print commands and manage print jobs

-Most hardware manufacturers write their own device driver software, meaning a single operating system may have several printer drivers installed

-When data is sent to a printer, the OS will communicate with the printer to ensure it’s switched on, check that it is a printer, etc. and then the data to be printed will be transferred to an area of memory called a buffer, so the CPU can carry on with another task- the buffer compensates for the difference in speed between the CPU and the printer/output device.

8
New cards

Backing Store Management

-When files/applications are loaded, they are transferred from backing storage into main memory.

-The OS keeps a directory of where files are stored so they can be accessed quickly.

-The OS also needs to know which areas of storage are empty so new files/applications can be stored there.

-The file management system that comes with a desktop OS enables us to move/delete files and folders and protect others from unauthorised access.

9
New cards

What is preemptive scheduling?

  • Allocates the CPU for a specific time quantum to a process

  • Allows interruption of processes currently being handled

  • It can result in low-priority processes being neglected if high-priority processes arrive frequently

  • Example algorithms include Round Robin and Shortest Remaining Time First

10
New cards

What is non-preemptive scheduling?

  • Once the CPU is allocated to a process, the process holds it until it completes its burst time or switches to a 'waiting' state

  • A process cannot be interrupted unless it completes or its burst time is reached

  • If a process with a long burst time is running, shorter processes will be neglected

  • Example algorithms include First Come First Served and Shortest Job First

11
New cards

Processor scheduling- round robin

-Pre-emptive program

-Each job is allocated a time slice during which it can use the CPU’s resources.

-If the job has not completed by the end of its time slice, the next job is given a time slice.

-The allocation of time slices continues until the jobs are finished.

12
New cards

Processor scheduling- first come, first served

-Non-pre-emptive algorithm

-The first job to arrive is executed to completion (similar to a supermarket queue)

13
New cards

Processor scheduling- shortest job first

-Non-pre-emptive algorithm

-All programs are continuously sorted by burst time from shortest to longest

-When new processes arrive on the queue, they are prioritised based on their burst time in the next cycle

-Shorter jobs are placed at the front of the priority queue

-Longer jobs have lower priority, so they are placed at the back

14
New cards

Processor scheduling- shortest remaining time

-Pre-emptive algorithm

-The job with the shortest estimated time to completion is run until a new job with a shorter estimated completion time arrives

-This can cause “job starvation”, which is said to occur when long jobs are held off indefinitely as new, shorter jobs continually join the queue.

15
New cards

Processor scheduling- multi-level feedback queues

-Pre-emptive algorithm

-Multiple queues with different priority levels are created

-If a job uses too much CPU time it is moved to a lower priority queue

-Processes can also be moved to a higher priority queue if they have waited a long time