0% found this document useful (0 votes)
5 views

Operating Systems Midterm Revision

The document provides a comprehensive overview of operating systems, detailing their components, functionalities, and the role of the kernel. It covers process management, resource allocation, threading models, and scheduling algorithms. Key concepts such as interrupts, exceptions, and the distinction between user and kernel modes are also discussed to illustrate how operating systems manage hardware and software resources effectively.

Uploaded by

nour.shalabyuni
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Operating Systems Midterm Revision

The document provides a comprehensive overview of operating systems, detailing their components, functionalities, and the role of the kernel. It covers process management, resource allocation, threading models, and scheduling algorithms. Key concepts such as interrupts, exceptions, and the distinction between user and kernel modes are also discussed to illustrate how operating systems manage hardware and software resources effectively.

Uploaded by

nour.shalabyuni
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Operating Systems Midterm Revision

Tutorial 1

Computer System split into:


Hardware : CPU/Memory/Hard Drive/Input Output Devices
Software
Application: Microsoft Office/Games/Browsers/Calculator
System: Kernel/Translators/Libraries/Utilities

Operating System
Piece of software which:
1. Act as intermediary between user and hardware resources
2. Assign requested resources to processes
3. Manage existing resources
Abstraction: hiding details and complexity of a system presenting a simplified view
1. Performs operations on behalf of programs
2. Introduce file abstraction so programs don’t need to have a disk to operate
3. Transforms computer hardware into multiple virtual computer
4. Can enforce security
Arbitration: Managing access to shared hardware resources
1. Allows devices or memory to be run by more than one user
2. Handles potential access conflicts between processors
Functionalities of OS
1. Execution of programs
 Load from secondary memory to main memory
 Provides CPU access to program
 Remove program from main mem after execution
2. CPU scheduling
 Maximize CPU utilization
 Minimize response time
3. Input/output management

Tutorial 2

Kernel
Core of the operating System
Responsible for:
1. Process management: creating/ scheduling/terminating processes
2. Memory management: management of main memory/disk during
process execution/ memory allocation
3. File system management: creating/organizing/accessing/controlling files
4. Device management: controlling input/output devices and device
communication
5. System call handling: mechanism used to request services from OS/
through APIs/type of exception

API (Application Programming Interface)


Applications do not need to know the specifics of the HW/OS and can run on
different platforms/devices with minimal changes
Kernel mode:
 System software
Privileged
Full access to resources

User mode:
Application software
Unprivileged
Limited access to resources

Interrupts (Asynchronous)
1. Signal emitted by hardware when an event needs immediate attention
2. Way to improve processor utilization
3. Most I/O devices are slower that processor
4. Handle them priority based

Exception (Synchronous)
1. Events that interrupt normal execution of a program
2. Caused by errors in the software

When interrupt/exception occurs


1. Switch from user to kernel mode
2. Stop currently executing process
3. Appropriate handler dispatched
4. Resume execution of process after handling
Tutorial 3

Process management:
 Creation
o User log in
o Spawned by existing process
 Termination
o Normal completion
o Time limit
o Parent termination
o Bounds violation/ Arithmetic error
 Scheduling/dispatching
 Process switching
 Management of process control blocks (contains all info about
process that is needed by OS)
Process (a program in execution)
1. Assign unique process identifier to new process
2. Allocate space in main memory
3. Initialize process control block
4. Set appropriate linkages
5. Create/expand other data structures
Program: group of instructions to carry out a task
Process control block :- Facilitates process management in OS
1. Process identification
 Process identifier
 Parent identifier
 User identifier
2. State information
 user Visible registers
 control and status registers
 stack pointers
3. Control information
a. Scheduling/ state information
b. Process privileges (what memory can be accessed)
c. memory management
d. resource ownership
Dispatcher used to switch from 1 process to another

Fork
1. system call creates a new process
2. copy of current process
3. return values are:
a. 0 (returned from child process)
b. + (succesful)
c. - (unsuccessful)

Tutorial 4

Resource ownership
 A process includes a virtual address space to hold the process image
 A process may be allocated ownership of resources
Scheduling/execution
 Process has an execution state and dispatching priority

Thread
 The smallest unit of execution
 Can execute independently within the same process
 Allow program to perform multiple tasks concurrently
 Improves responsiveness
 Resource sharing with threads in the same process
 Deadlocks may occur from improper synchronization

User-level threads
1. Managed by user space libraries
2. Kernel is unaware of existence of ULT
3. Lightweight/ low overhead
4. Unable to take advantage of multiprocessor systems
5. Blocking system may block all threads
6. Scheduling can be application specific
7. Can run on any operating systm

Kernel-level threads
1. Managed by OS kernel
2. Each thread represented as a separate entity in the kernel with its own
thread control block
3. Threads can be distributed to multiple CPU’s
4. Higher overhead

Jacketing
1. Converts blocking system call into non-blocking system call
2. Thread calls application level I/O routine
3. Within jacket routine there’s code that checks if I/O device is busy
4. If busy thread enters block state and passes control to another thread

Threads Mapping Model I


1. Many to one model
2. Many user level threads mapped to one kernel level thread
Threads Mapping Model II
1. One to one model
2. User thread to kernel level thread
Threads Mapping Model III
1. Many to many model
2. Blocking call made, one kernel thread maintains proper execution of the
blocked thread and another ensures the execution of the other threads
Process
 unit of resource ownership
POSIX threads in OS: has different functions to create/terminate/manage threads

Scheduling algorithms
Preemptive: OS can interrupt or suspend execution
 First Come First Served (FCFS)  non-preemptive
 Short job first  non-preemptive
 Highest response rate next  non-preemptive
 Round Robin (RR)  preemptive
 Shortest remaining time next  preemptive
 Turnaround time = Finish time- Arrival time

Multi-level feedback
1. Four priority levels
2. Quantum length for the highest level 1 time unit and is doubled as we move
down the priority
Types of Tasks
1. Periodic
a. Task repeated after a period time
b. Hard deadlines
2. Aperiodic
a. Unpredictable 1 shot task
b. Soft or no deadlines
3. Sporadic
a. Unpredictable 1 shot task
b. Hard deadlines
Polling server
1. Periodic task used to serve aperiodic requests
2. Released periodically with period Ps
3. Serves pending aperiodic request
4. Suspends itself if:
a. Used its capacity
b. No aperiodic request pending
5. Server capacity replenished

You might also like