unit 2 Flashcards
what are the functions of the OS?
user interface
memory management
interrupt handling
processor scheduling
file management
what is the purpose of a UI?
the OS hides the complexity of the hardware from the user by providing a user interface
why is memory management needed?
programs and their data need to be loaded into RAM
the OS must manage allocation of RAM to the different programs
what are the 2 types of memory management?
paging and segmentation
how does paging work?
- available memory is divided into fixed size chunks called pages
- each page has an address
- a process loaded into RAM is allocated sufficient pages but may not be contiguous
how does segmentation work?
memory is divided into segments which can be of different lengths
segments can relate to parts of a program like a function
what are the benefits to paging?
As users move between applications, memory is dynamically allocated
Pages will be taken away from applications not in active use and granted to applications that are in active use
what are the disadvantages of paging?
can lead to internal fragmentation
unused space in a page is wasteful
what are the advantages of segmentation?
space efficient due to allocating space depending on the amount an application needs
what are the disadvantages to segmentation?
can lead to external fragmentation
physical gaps reduce the maximum size of new segments
what is virtual memory?
secondary data which acts as an extension of main memory
what is the purpose of virtual memory?
to create an illusion of larger memory and so the OS can offload data from primary memory into vm
how does virtual memory work?
when memory intensive applications exceed the available RAM the OS moves less frequently accessed pages to the hard disk
what is an interrupt?
a signal to the processor that stops its current task and performs a different task temporarily and transfers control to an ISR
what are the purposes of interrupts?
real time event handling - hardware errors
device communication - alerts from printers for example
multitasking - suspending processing in one application so that the user can switch to another
what are the steps of an interrupt?
- external device or software generates an interrupt signalling to the processor to stop its current task
- the interrupt handler decides if the interrupt needs to be dealt with now or later
- if now, the current contents of the processor registers are pushed onto a stack
- the processor fetches the right ISR
- the processor transfers controls to the ISR and is executed
- the processor restores the contents of the registers by popping the stack and continues the previous task
what is an ISR?
a special function that handles a particular interrupt type
why do we need interrupt priority?
means the process can acknowledge and switch to resolving a higher priority interrupt
many things can go wrong at the same time
what is interrupt nesting?
the ability of the processor to handle interrupts within interrupts
why do we need interrupt nesting?
avoids potential conflicts and ensures system stability
what is scheduling?
the process of deciding which tasks to process, for how long and in what order
what are the aims of scheduling?
provides an acceptable response time to all users
to maximise the time the CPU is usefully engaged
to ensure fairness on a multi user system
what is preemptive scheduling?
allocates the CPU for time limited slots
what is non preemptive scheduling?
allocates the CPU to tasks for unlimited time slots