0% found this document useful (0 votes)
5 views6 pages

OS Reading

The document provides an overview of operating systems (OS), detailing their functions, structures, and operations, including process management and threading. It explains key concepts such as interrupts, multiprogramming, process states, and the differences between processes and threads. Additionally, it covers various computing environments and special-purpose systems, along with threading issues and examples of multithreading in applications.

Uploaded by

dagimnega66
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)
5 views6 pages

OS Reading

The document provides an overview of operating systems (OS), detailing their functions, structures, and operations, including process management and threading. It explains key concepts such as interrupts, multiprogramming, process states, and the differences between processes and threads. Additionally, it covers various computing environments and special-purpose systems, along with threading issues and examples of multithreading in applications.

Uploaded by

dagimnega66
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
You are on page 1/ 6

Chapter 1

1. What is an Operating System (OS)?

 A program that acts as an intermediary between the user and the computer hardware.
 Goals:
o Execute user programs efficiently.
o Make the computer convenient to use.
o Allocate resources fairly.
o Control program execution to prevent errors.

2. Computer System Structure

 Components: User, Application Programs, Operating System, Hardware (CPU, Memory,


I/O).
 Organization: CPU and device controllers connected via a bus to shared memory.

3. Operating System Operations

 Interrupts: Signals that stop current execution to handle urgent tasks.


 Multiprogramming: Keeps the CPU busy by running multiple jobs.
 Timesharing: Extends multiprogramming for interactive user access.
 Dual-Mode Operation:
o User Mode: General program execution.
o Kernel Mode: OS execution for system control.

4. Computing Environments

 Traditional: Client-server, standalone PCs.


 Web-Based: Networked environments, cloud computing.
 Peer-to-Peer (P2P): Direct data exchange without a central server.

5. OS Structure

 Monolithic (MS-DOS): Single-layer OS, limited separation of functionality.


 Layered Approach: OS divided into modular layers (UNIX).
 Microkernel: Minimal kernel, moves services to user space for security.
 Virtual Machines: OS simulates multiple independent machines (e.g., VMware).

6. OS Functions

 Process Management: Creation, scheduling, synchronization of processes.


 Memory Management: Allocation, deallocation, virtual memory support.
 Storage Management: File systems, disk management.
 I/O Management: Device drivers, buffering, caching.
 Networking: Supports communication protocols (e.g., FTP, HTTP).
 Security & Protection: User authentication, data integrity.

7. OS Services

 User Services: Program execution, I/O operations, file system management.


 System Services: Resource allocation, accounting, protection.

8. Shell and System Calls

 Shell: Command-line interface between users and the OS.


 System Calls: Functions that allow programs to request OS services.

9. Special-Purpose Systems

 Embedded Systems: Real-time OS for industrial, automotive, and consumer devices.


 Multimedia Systems: Handle audio/video processing.
 Handheld Devices: Mobile OS with optimized resource management.

10. Reading Assignments

 Study different OS types (batch systems, time-sharing, etc.).


 Understand cache memory and its advantages.
 Explore system calls and their uses.
Chapter 2

1. Process Concept

 A process is a program in execution (active entity), while a program is a passive entity.


 Requires resources like CPU, memory, and I/O to execute.
 Modern OS allows multiple processes to run concurrently for better performance.

2. Process Structure

 Text Section: Code of the program.


 Program Counter (PC): Tracks the next instruction to execute.
 Stack: Holds temporary data (function parameters, local variables).
 Data Section: Contains global variables.
 Heap: Memory dynamically allocated during execution.

3. Process States

 New: Just created.


 Ready: Waiting for CPU allocation.
 Running: Currently executing.
 Waiting (Blocked): Waiting for an event (e.g., I/O).
 Terminated: Finished execution.

4. Process Control Block (PCB)

A data structure storing process-related information:

 Process ID (unique identifier).


 Process state (Ready, Running, etc.).
 Program Counter (next instruction).
 CPU registers (current state of execution).
 Memory allocation details.
 I/O status and scheduling information.

5. Process Scheduling

 Long-Term Scheduler: Controls degree of multiprogramming (chooses which processes


to load into memory).
 Short-Term Scheduler (CPU Scheduler): Decides which process runs next.
 Medium-Term Scheduler: Swaps processes in and out of memory to optimize
performance.

6. Context Switching

 Switching the CPU from one process to another.


 OS saves the current process state (PCB) and loads another process.
 Causes overhead but enables multitasking.

7. Process Creation & Termination

 Parent creates child process (e.g., using fork() in UNIX).


 Processes can share resources (fully, partially, or not at all).
 Termination Reasons: Normal completion, errors, exceeding resource limits, parent
termination.

8. Cooperating Processes & Inter-Process Communication (IPC)

 Independent Processes: Do not affect or communicate with others.


 Cooperating Processes: Share data, synchronize actions.
 IPC Mechanisms:
o Shared Memory: Fast, requires synchronization.
o Message Passing: Exchange messages, safer but slower.

9. Synchronization & Producer-Consumer Problem

 Producer-Consumer Problem:
o Producer generates data, consumer processes it.
o Uses bounded/unbounded buffer.
o Synchronization required to avoid overwriting or reading empty buffer.
o Semaphores are often used to solve synchronization issues.

10. Process Communication Models

 Direct Communication: Processes explicitly name each other.


 Indirect Communication: Uses mailboxes (message queues).
 Synchronous vs. Asynchronous Messaging: Blocking (waits) vs. Non-blocking
(proceeds).

11. Process Scheduling Queues

 Job Queue: All processes in the system.


 Ready Queue: Processes in memory, waiting for CPU.
 Device Queue: Waiting for I/O.

12. Process Scheduling Algorithms (Covered in Future Lectures)

 First-Come, First-Served (FCFS)


 Shortest Job Next (SJN)
 Round Robin (RR)
 Priority Scheduling
Chapter 3

1. What are Threads?

 A thread is the smallest unit of CPU execution within a process.


 Processes vs. Threads:
o A process has its own memory space, while threads share the same memory space.
o Threads have their own program counter, registers, and stack, but share code, data,
and system resources.
o Context switching between threads is faster than between processes.

2. Why Use Threads?

 Efficiency: Reduces overhead of creating new processes.


 Parallel Execution: Multiple tasks run simultaneously (e.g., web servers handling multiple
requests).
 Resource Sharing: Threads within a process share resources easily.
 Responsiveness: UI remains responsive even if computations are ongoing.
 Scalability: Utilizes multi-core processors effectively.

3. Types of Threads

 User Threads: Managed by user-space libraries, without OS support.


 Kernel Threads: Managed by the OS, requiring system calls.
 Multithreading Models:
o Many-to-One: Multiple user threads map to one kernel thread (efficient but limited).
o One-to-One: Each user thread has a kernel thread (better concurrency but costly).
o Many-to-Many: Many user threads mapped to many kernel threads (best balance).

4. Thread Libraries

 POSIX Threads (pthreads): Used in Unix/Linux.


 Win32 Threads: Windows OS threading model.
 Java Threads: Managed by the Java Virtual Machine (JVM).

5. Threading Issues

 Thread Cancellation:
o Asynchronous: Kills a thread immediately.
o Deferred: Thread checks if it should terminate.
 Signal Handling: How threads handle UNIX signals (sent to all threads, specific threads, or a
handler thread).
 Thread Pools:
o Instead of creating/destroying threads frequently, a fixed number of threads are
maintained.
o Improves performance and prevents excessive thread creation.
 Thread-Specific Data: Some data is unique to each thread, even though threads share memory.
 Scheduler Activation: Communication between kernel and thread library to allocate kernel
threads efficiently.

6. CPU Hogging Prevention

 Strategy 1: Yield()
o A thread voluntarily gives up the CPU, allowing other threads to execute.
 Strategy 2: Preemption
o OS uses a timer interrupt to force context switching.

Examples of Multithreading

 Word Processor: One thread handles keystrokes, another checks spelling, another auto-saves.
 Web Server: Multiple threads process user requests simultaneously.
 Spreadsheet: One thread updates calculations while another handles user input.

You might also like