


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Program that operates as the interface between the user and the hardware
Web Browser
Accting package
etc.
Compiler Editors Command Window Interpreter system
Operating System - file system, memory manager, etc.
Hardware - CPU, memory, I/O devices
Runs in User Mode
Runs in Kernel or Supervisor Mode
system calls
CPU
data
addr.
control
data reg status reg
address on
command reg
I/O Module/Controller
data
status
control
I/O Device
e.g., writing/reading to an I/O device
OS provides high-level system calls so programmer does no need to know details of I/O devicet
I/O device reg
System Bus
Resources competed for by several programs
Examples:
OS - 1
Many processes execute concurrently, but only one can be executing on a CPU at a time. When the CPU switches to another process, a context switch occurs which involves saving the complete state of the previously executing process before loading the state of the next process to execute into the CPU. Depending on the hardware, this can take 1 to 1000 microseconds (i.e., very slow in computer terms).
Process State Diagram
new
waiting
I/O request or event wait
I/O completion event signaled
Scheduler Dispatched
Interrupt (CPU timer)
Admitted (short-term) Exit ready running (^) terminated
Queues are used to hold process control blocks (PCB) that represent processes internally to the OS.
Process Control Block
Next PCB in queue pointer
Process State Program Counter
Registers Memory Mgt. Info
CPU Scheduling Info.
Accounting Info. I/O Status Info
CPU Timer - OS sets a timer to expire and interrupt a user pgm before the user pgm is started. Remember that only one program (in a single CPU system) can be executing at a time so when the OS turns control over to a user program it has “lost control.” Modifications to the CPU timer are privileged
Dual-Mode Operation - the CPU has two (or more) modes of operation: user mode and system(/supervisor/monitor/privileged) mode with some privileged instructions only executable in system mode. A mode-bit within the CPU's processor-status-word (PSW) register is used to indicate whether the CPU is executing in user or system mode. The set of all machine-language instructions are divided into: a) privileged instructions that can only be executed in system mode, and b) non-privileged instructions that can be executed in any mode of operation.
Every time an instruction is executed by the CPU, the hardware checks to see if the instruction is privileged and whether the mode is user. Whenever this case is detected, an exception (internal interrupt) is generated that turns CPU control back over to the operating system.