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

UNIX Process Notes Complete

The document outlines system calls for controlling process context in UNIX, detailing important calls like fork(), exec(), and wait(). It also describes the process state diagram and various UNIX scheduling algorithms, including Round Robin and First Come First Serve, along with their advantages and disadvantages. Additionally, it provides concise explanations of fork(), exec(), context switching, and Round Robin scheduling for exam preparation.
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)
14 views3 pages

UNIX Process Notes Complete

The document outlines system calls for controlling process context in UNIX, detailing important calls like fork(), exec(), and wait(). It also describes the process state diagram and various UNIX scheduling algorithms, including Round Robin and First Come First Serve, along with their advantages and disadvantages. Additionally, it provides concise explanations of fork(), exec(), context switching, and Round Robin scheduling for exam preparation.
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

Complete Notes: System Calls & UNIX Process

Scheduling

1. System Calls for Controlling Process Context


System calls provide an interface between user programs and the operating system kernel. They
control process creation, execution, and termination.

Important System Calls with Syntax:


System Call Syntax Purpose
fork() pid_t pid = fork(); Creates a child process.
exec() execl(path, arg0, ..., NULL); Replaces process memory with new program.
wait() wait(&status); Parent waits for child completion.
exit() exit(status); Terminates a process.
getpid() pid_t id = getpid(); Gets process ID.
kill() kill(pid, SIGTERM); Sends signal to process.
nice() nice(increment); Changes process priority.

Process State Diagram:


+------ NEW ------+
|
v
+-- READY --+
| |
| v
+-- RUNNING --+ |
| ^ |
| | |
v | |
WAITING -------+
|
v
TERMINATED
A process moves from New to Ready to Running. It may move to Waiting for I/O and return to
Ready. After completion, it enters the Terminated state.
2. UNIX Process Scheduling Mechanism
Detailed Scheduling Algorithms:
1 Round Robin: Each process gets fixed CPU time (time quantum). Suitable for time-sharing
systems.

2 First Come First Serve (FCFS): Processes execute in arrival order.


3 Shortest Job First (SJF): Process with smallest execution time is scheduled first.
4 Priority Scheduling: CPU assigned based on priority level.
5 Multilevel Queue Scheduling: Separate queues for different process types.
6 Multilevel Feedback Queue: Processes move between queues based on execution behavior.

Comparison of Scheduling Algorithms:


Algorithm Advantage Disadvantage
FCFS Simple to implement Convoy effect, long waiting time
SJF Minimum average waiting time Hard to predict burst time
Round Robin Fair CPU allocation High context switching overhead
Priority Important processes executed first Starvation possible
3. Exam-Oriented Short Notes / 10-Mark Answers
Write a short note on fork() and exec():
fork() creates a new process by duplicating the parent process. The child process runs concurrently
with the parent. exec() replaces the current process memory with a new program. fork() and exec()
are often used together.

Explain Context Switching:


Context switching is the process of saving the state of one process and loading the state of another
process. It enables multiple processes to share CPU time.

Explain Round Robin Scheduling:


Round Robin scheduling assigns a fixed time slice to each process in cyclic order. It ensures
fairness and responsiveness.

You might also like