0% found this document useful (0 votes)
15 views22 pages

Operating Systems Operations

The document discusses the role and operations of operating systems, including bootstrapping, kernel execution, and system calls. It covers concepts such as multiprogramming, multitasking, memory management, dual-mode operation, and the use of timers for CPU control. Key features include process protection, event handling, and the importance of system daemons and privileged instructions.

Uploaded by

jayantsharma3228
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views22 pages

Operating Systems Operations

The document discusses the role and operations of operating systems, including bootstrapping, kernel execution, and system calls. It covers concepts such as multiprogramming, multitasking, memory management, dual-mode operation, and the use of timers for CPU control. Key features include process protection, event handling, and the importance of system daemons and privileged instructions.

Uploaded by

jayantsharma3228
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Operating Systems

Operations
Operating System Concepts
by
Abraham Silberschatz, Greg Gagne and Peter B. Galvin

Dr.S.Meenatchi, SCORE, VIT, Vellore.


Operating Systems Operations
• Role of the Operating System
• OS provides - environment for program execution.
• Internally, OS design varies widely but shares common features.
• OS must be loaded before it can manage system operations.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


Operating Systems Operations cont..
• Bootstrapping the System
• At power-on or reboot, computer runs an initial program:
• Called Bootstrap Program.
• Typically stored in firmware (ROM or EEPROM).
• Responsibilities of Bootstrap:
• Initialize CPU registers, device controllers, and memory.
• Locate and load the OS kernel into memory.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


Operating Systems Operations cont..
• Kernel Execution
• After loading, kernel starts executing.
• Kernel:
• Provides core system services.
• Manages processes, memory, I/O, etc.
• System Programs and Daemons
• Some services are handled by system programs, not the kernel.
• These programs are loaded at boot time and become system daemons.
• On Linux:
• First program: system.
• Starts and manages other daemons continuously.
Dr.S.Meenatchi, SCORE, VIT, Vellore.
Operating Systems Operations cont..
• Waiting for Events
• Once booting is complete, system is idle until an event occurs.
• If no tasks or users are active, OS waits passively.
• Events and Interrupts
• Events are usually signaled by interrupts.
• Two main types:
• Hardware Interrupts: Triggered by external hardware (e.g., keyboard input,
disk I/O)
• Traps (Software Interrupts):
• Caused by errors (e.g., divide by zero)
• Or by system calls (user program requests an OS service)
Dr.S.Meenatchi, SCORE, VIT, Vellore.
Operating Systems Operations cont..
• System Call Mechanism
• A system call is a way for user programs to request services from OS.
• Generates a trap/exception, switching control to OS.
• Examples:
• File access
• Memory allocation
• Process control

Dr.S.Meenatchi, SCORE, VIT, Vellore.


Operating Systems Operations cont..
• Summary
• OS startup begins with bootstrap program.
• Kernel is loaded to manage system operations.
• System daemons provide services outside the kernel.
• OS remains idle until interrupts or system calls occur.
• Traps enable communication between user programs and OS.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


1. Multiprogramming and Multitasking
• Why Multiprogramming?
• A single program cannot keep CPU and I/O devices busy all the time.
• Users often want to run multiple programs simultaneously.
• Goal: Improve CPU utilization and user satisfaction.
• What is Multiprogramming?
• Multiple processes (programs in execution) are kept in main memory.
• OS selects one to run; when it waits (e.g., for I/O), CPU switches to another.
• CPU is never idle as long as a process is ready.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


1. Multiprogramming and Multitasking cont..
• What is Multitasking?
• Extension of multiprogramming for interactive systems.
• CPU rapidly switches between processes for quick user
response.
• Useful during interactive I/O like typing or mouse clicks.
• Need for Memory Management
• Multiple processes in memory require memory
management.
• OS must:
• Allocate memory efficiently.
• Isolate processes from interfering with each other.
Dr.S.Meenatchi, SCORE, VIT, Vellore.
1. Multiprogramming and Multitasking cont..
• CPU Scheduling
• If multiple processes are ready, OS must choose which runs next.
• CPU scheduling is critical for:
• Efficiency
• Fairness
• Responsiveness
• Process Protection & Coordination
• Processes must be protected from affecting each other.
• OS ensures:
• Process synchronization and communication.
• Deadlock avoidance and detection.
Dr.S.Meenatchi, SCORE, VIT, Vellore.
1. Multiprogramming and Multitasking cont..
• Virtual Memory
• Allows execution of programs larger than physical memory.
• Creates an abstraction of memory as a large, continuous space.
• Helps ensure good response time and simplifies programming.
• File System & Storage Management
• File system is essential in multi-tasking systems.
• Resides on secondary storage.
• OS must manage:
• Files
• Disk space
• Access control
Dr.S.Meenatchi, SCORE, VIT, Vellore.
1. Multiprogramming and Multitasking cont..
• System Protection
• OS must protect resources from misuse or unauthorized access.
• Involves user permissions, resource limits, and security policies.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


2. Dual-Mode and Multimode Operation
• Need for Mode Separation
• OS and user programs share hardware resources.
• Must protect OS and programs from incorrect or malicious behavior.
• Solution: Differentiate between user and kernel code execution.
• Dual-Mode Operation
• Two modes:
• User Mode (Mode bit = 1): Executes user applications.
• Kernel Mode (Mode bit = 0): Executes OS code.
• Mode bit in hardware indicates current execution mode.
• Kernel Mode - also called supervisor mode, system mode, or privileged mode.
Dr.S.Meenatchi, SCORE, VIT, Vellore.
2. Dual-Mode and Multimode Operation cont..

Dr.S.Meenatchi, SCORE, VIT, Vellore.


2. Dual-Mode and Multimode Operation cont..
• Mode Switching
• At boot time: System starts in kernel mode.
• OS loads, then switches to user mode to run applications.
• Switch to kernel mode happens during:
• Interrupts
• Traps (Error)
• System calls

Dr.S.Meenatchi, SCORE, VIT, Vellore.


2. Dual-Mode and Multimode Operation cont..
• Privileged Instructions
• Certain instructions can only be executed in kernel mode.
• Examples:
• I/O control
• Interrupt handling
• Timer management
• Attempting these in user mode → trap to OS
• Multimode Operation
• Some CPUs support more than two modes:
• Intel x86: 4 rings (Ring 0 = kernel, Ring 3 = user)
• ARMv8: 7 modes
• Virtualization: Mode for Virtual Machine Manager (VMM)
Dr.S.Meenatchi, SCORE, VIT, Vellore.
2. Dual-Mode and Multimode Operation cont..
• System Call Process
• Control passes to OS via interrupt vector.
• Mode switches to kernel mode.
• OS:
• Identifies the service request.
• Validates parameters.
• Performs requested operation.
• Returns control to user mode.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


2. Dual-Mode and Multimode Operation cont..
• Error Handling with Protection
• Hardware detects:
• Illegal instructions
• Invalid memory access
• Traps to OS → abnormal termination
• OS:
• Displays error message.
• Creates memory dump file for debugging.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


2. Dual-Mode and Multimode Operation cont..
• Summary
• Dual-mode ensures separation of user and OS tasks.
• Mode bit enables secure transitions.
• Privileged instructions protect system integrity.
• System calls are the bridge between user space and OS.
• Errors and traps are handled securely by OS.

Dr.S.Meenatchi, SCORE, VIT, Vellore.


3. Timer
• Purpose of Timer
• Ensures OS retains control over the CPU.
• Prevents user programs from:
• Running indefinitely (infinite loops).
• Never returning control to OS.
• How Timer Works
• A timer is set to generate an interrupt after a specific time.
• Types of timing intervals:
• Fixed (e.g., 1/60 second)
• Variable (e.g., 1 ms to 1 second)

Dr.S.Meenatchi, SCORE, VIT, Vellore.


3. Timer cont..
• Implementation
• Based on a fixed-rate clock and a counter.
• OS sets the counter value.
• Clock ticks → counter decrements.
• When counter = 0 → interrupt is generated.
• Example
• A 10-bit counter with 1 ms clock:
• Timer range: 1 ms to 1024 ms
• Step size: 1 ms

Dr.S.Meenatchi, SCORE, VIT, Vellore.


3. Timer cont..
• Use in Context Switching
• Timer is set before giving control to user.
• On timer interrupt:
• OS regains control.
• May terminate, pause, or extend the program.
• Security/Control
• Modifying the timer is a privileged instruction.
• Only OS (in kernel mode) can change timer settings.

Dr.S.Meenatchi, SCORE, VIT, Vellore.

You might also like