16.1 Operating System (0S)
16.1 Operating System (0S)
16.1 Operating System (0S)
16.1
16.1.1 How an operating system can maximise the use of
computer resources
When a computer is first switched on
BIOS (basic input/output system) in ROM starts A BOOTSTRAP
PROGRAM
BOOTSTRAP PROGRAM loads OS in hard disk/SSD into RAM
Flash memory
Although tablets and mobile phones use RAM, that process is less obvious
(instantaneous).
Because their main internal memory is supplied by FLASH MEMORY
Flash memory is split into two parts
1. The part where the OS resides. It is read only. This is why the OS can be updated
by the mobile phone/tablet manufacturers but the user cannot interfere with the
software or ‘steal’ memory from this part of memory.
2. The part where the apps (and associated data) are stored.
The user does not have direct access to this part of memory either.
RAM stores the apps executing and data currently in use.
Resource management
OS’s task is to maximize the utilization of computer resources
1. the CPU
2. memory
3. the input/output (I/O) system.
Scheduling for better utilization of CPU time and resources
OS will do:
● any I/O operation which has been initiated by the computer user
● any I/O operation which occurs while software is being run and resources, such as
printers or disk drives, are requested.
DMA
The direct memory access (DMA) controller is needed to allow hardware
to access the main memory independently of the CPU.
carried out
● Determines CPU allocation for processes in the ready state after OS calls.
● Deadline:
● Memory Requirements:
16.1.3
Process states
16.1.3 Process states
Process control block (PCB) – data structure which contains all the data
needed for a process to run.
Once a process is executed during its time slice, it is removed and placed in
the blocked queue; then another process from the ready queue is executed
in its own time slice.
The ready queue gives each process its time slice in the correct order (if a
process completes before the end of its time slice, then the next process is
brought into the ready queue for its time slice).
Average waiting times for the four scheduling routines
Interrupt handling with OS kernels
Types of interrupts:
● Device interrupt (for example, printer out of paper, device not present,
and so on).
● Exceptions (for example, instruction faults such as division by zero,
unidentified op code, stack fault, and so on).
● Traps/software interrupt (for example, process requesting a resource
such as a disk drive).
When an interrupt is received, the kernel will consult the interrupt dispatch
table (IDT) – this table links a device description with the appropriate
interrupt routine.
Interrupts will be prioritised using interrupt priority levels (IPL) (numbered 0
to 31). A process is suspended only if its interrupt priority level is greater
than that of the current task. The process with the lower IPL is saved in the
interrupt register and is handled (serviced) when the IPL value falls to a certain
level.
Examples of IPLs include:
31: power fail interrupt
24: clock interrupt
20-23: I/O devices
16.1. 4
Memory
Management
16.1.4 - Memory Management
fragmentation.
● Processes allocated more pages than needed and loaded into frames
during execution.
Segmentation
Segmented memory
address of segment in physical memory space = segment number + offset value
Summary of the differences between paging and segmentation
Video - OCR A Level (H046-H446) SLR4 - 1.2
Paging, segmentation and virtual memory
● Virtual memory is RAM + swap space on the hard disk (or SSD)
Problem Solution
● Multiple processes running-> separately mapping each program’s
no available memory in RAM. memory space to RAM and utilising
HDD
Without Virtual Management:
With Virtual Management:
The main benefits of virtual memory are
» programs can be larger than physical memory and can still be executed
» there is no need to waste memory with data that is not being used (for
example, during error handling)
» it removes the need to buy and install more expensive RAM memory.
Disk Thrashing: Thrash point:
More and more data pages move More time spent on moving
in/out of virt.mem->more read/write pages;speed decreases,process
movements. comes to a halt.
Both are essential to the efficient and stable running of any computer system.