0% found this document useful (0 votes)
10 views3 pages

Operating Systems Study Notes: System Calls & Processes

The document covers key concepts of operating systems, including system calls, the system call interface, and user/kernel modes. It explains processes, their management, and the role of threads, detailing their structures and models. Additionally, it discusses interrupts and how they facilitate efficient CPU response to events.

Uploaded by

teng teng
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)
10 views3 pages

Operating Systems Study Notes: System Calls & Processes

The document covers key concepts of operating systems, including system calls, the system call interface, and user/kernel modes. It explains processes, their management, and the role of threads, detailing their structures and models. Additionally, it discusses interrupts and how they facilitate efficient CPU response to events.

Uploaded by

teng teng
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 - Module 2 Study Notes

1. System Calls

A system call is the mechanism by which a program requests a service from the operating system's
kernel.
User programs cannot directly access hardware or privileged instructions; instead, they invoke
system calls
like open, read, write, fork, or exec. These calls cause a controlled switch from user mode to kernel
mode,
allowing the OS to perform tasks such as file operations, process management, and device control.
This ensures
security and stability by controlling hardware access through the OS.

2. System/Application Call Interface

The System Call Interface (SCI) is the boundary between user applications and the OS kernel.
Applications
usually interact with the OS via APIs provided by programming libraries, which internally call system
calls.
For example, printf in C calls the write system call. This separation allows applications to be
portable,
while the system call interface handles the specifics of the underlying OS.

3. Protection: User/Kernel Modes

Modern CPUs provide at least two execution modes: user mode and kernel mode. User mode
restricts access
to hardware and critical instructions, protecting the system from faulty or malicious code. Kernel
mode
grants full privileges, allowing direct hardware management. The OS switches between these
modes when
handling system calls or interrupts, ensuring controlled access to system resources.
4. Interrupts

An interrupt is a signal indicating that an event needs immediate CPU attention. Hardware interrupts
come
from devices like keyboards or network cards, while software interrupts are generated by programs
(e.g.,
system calls, exceptions). When an interrupt occurs, the CPU saves its state, switches to kernel
mode, and
executes an Interrupt Service Routine (ISR) to handle the event. This allows the CPU to respond to
asynchronous
events efficiently without continuous polling.

5. Processes

A process is a program in execution, containing its own memory space, registers, and resources.
Processes
move through states such as new, ready, running, waiting, and terminated. The OS manages
process execution,
scheduling, and synchronization to ensure efficient CPU use and isolation between processes.

6. Process Structures

The Process Control Block (PCB) is a data structure that stores all information about a process,
including
its state, process ID, CPU registers, memory allocation, I/O status, and scheduling details. The
Ready List
is a queue of processes waiting to be executed by the CPU scheduler.

7. Process Creation and Management in Unix

In Unix, new processes are created using the fork() system call, which creates a child process
identical
to the parent. The child can use exec() to replace its memory space with a new program. The parent
process
can use wait() to pause until the child finishes. Processes terminate using exit(), releasing their
resources.

8. Threads

A thread is the smallest unit of execution within a process. Multiple threads share the same code,
data,
and resources but have separate stacks and registers. User-level threads are managed by libraries
and are
faster to create but less integrated with the OS, while kernel-level threads are managed by the OS
itself,
providing better concurrency but with higher overhead.

9. Thread Models

- Many-to-One: Multiple user threads mapped to a single kernel thread; efficient but lacks true
concurrency.
- One-to-One: Each user thread maps to its own kernel thread; allows parallelism but uses more
resources.
- Many-to-Many: Multiple user threads mapped to a pool of kernel threads; balances flexibility and
performance.

You might also like