To prevent user programs from interfering with the proper operation of the system, the system hardware has two modes: user mode and kernel mode.
Various instructions are privileged and can be executed only in kernel mode
Examples include the instruction to switch to kernel mode, I/O control, timer management,and interrupt management.
Storage space is managed by the operating system; this includes providing file systems for representing files and directories and managing space on mass-storage devices.
Operating systems provide mechanisms for protecting and securing the operating system and users. Protection measures control the access of processes or users to the resources made available by the computer system.
Data structures that are used in an operating system include lists, stacks, queues, trees, and maps.
Smallest unit of data transferable, each block maps to a physical sector of HDD or semi-conductor page
When a process needs I/O, it issues a System Call to the OS, which need several pieces of infor:
disk/memory address
number of logical blocks to be transfered
Scheduling algorithms for HDD:
Evaluated on:
Device bandwidth = the total number of bytes transferred/the total between the first request for service and the completion of the last transfer.
The total head movement from the first transfer request to the last transfer request. (#cylinders)
FCFS: move the the next on in the queue
can be zigzag
SSTF (shortest seek time first): move the the closest pending position first
can cause starvation
greedy approach
SCAN: The head moves toward one direction while servicing all the requests in that direction until it reaches the end of the disk (at 0 or max). After that, it starts moving in the other direction
elevator algorithm
C-SCAN: Similar to SCAN, but when the head reaches the other end (at max), however, it immediately returns to the beginning of the disk (at 0) without servicing any requests on the return trip
C-LOOK: Similar to SCAN, but but is its practical version, where the head moves towards one direction while servicing all the requests in that direction until it reaches the last request (without reaching the max). After that it starts moving towards the other direction
→ Linux utilizes “deadline scheduler” which maintains separate read and write queues, and gives read priority
SSD scheduling: Flash memory-based devices do not contain moving disk heads and therefore, doesnt make a difference in which is read first → use FCFS