CS492 Complete Midterm Review
Processes:
● Process - a program in execution
● A single CPU at any given time may only run one process
● CPU Utilization: 1 - pn
● Processes don’t share memory address space
Syscalls
...
CS492 Complete Midterm Review
Processes:
● Process - a program in execution
● A single CPU at any given time may only run one process
● CPU Utilization: 1 - pn
● Processes don’t share memory address space
Syscalls: Calling a kernel mode service from user mod program
● switches execution to kernel mode
● Programming interface to services provided by the OS
● Typically written in a high-level language
● APIs:
○ Win32 API (Windows)
○ POSIX API (POSIX-based systems: UNIX, Linux, MacOS)
● Types of syscalls:
○ Process control
○ File management
○ Device management
○ Information maintenance
○ Communications
● Return codes
○ s is -1 if error has occurred
○ fd is a file descriptor
○ n is a byte count
○ position is an offset within the file
● OS-to-Process Communication: a way for the OS to inform the process about something
○ “Asks” process to take an action based on the information
Threads:
●
Inter-Process Communications:
Two main functions of an OS:
● Resource management
● User-friendliness for interaction with the hardware
Scheduling:
● Scheduling decisions may take place when a process/thread
○ Is created
○ In running state exits
○ Blocks on IO, or an event
● Scheduling decisions may take place when an interrupt occurs○ Clock interrupt
■ Switch from running to ready
○ IO interrupt, or (unblocking) syscall
■ Switch from blocked to ready
● Scheduling takes place at clock interrupts
● A way for a system to keep track of time
○ Interrupt at periodic intervals
○ Implemented using a hardware clock interrupt
○ High priority
● Non-preemptive scheduling
○ Voluntary process switch(yield)
○ Process switch on blocking calls
○ The scheduler gets involved only at exit or on request
● Preemptive scheduling
○ Involuntary process switch
○ For every clock interrupt, running process may be suspended
and switched with another process(if there is any)
● Different environments different scheduling algorithms are needed
● Different application areas have different goals
● Environments
○ Batch Systems
○ Interactive Systems
○ Real-time Systems
● Scheduling Algorithms Goals
○ All Systems
■ Fairness: giving each process a fair share of the CPU
■ Policy enforcement: seeing that stated policy is carried
out
■ Balance: keeping all parts of the system busy
○ Batch Systems
■ Throughput: maximize jobs per hour
■ Turnaround time: minimize time between submission and
termination
[Show More]