Professional Documents
Culture Documents
Introduction to kernel
3
Process Control Subsystem
• It is responsible for :
1. Process Synchronization
2. Interprocess communication
3. Memory management
4. Scheduler : process scheduling
(allocate CPU to Processes)
8
Key Attributes of a UNIX Process
Each UNIX process has many attributes associated with it. The following list
contains some of the key attributes of a process:
9
10
11
User Table (u area)
• Each process has only one private user table.
• User table contains information that must be accessible
while the process is in execution.
A pointer to the process table slot
parameters of the current system call, return values
error codes
file descriptors for all open files
current directory and current root
process and file size limits.
• User table is an extension of the process table.
12
U Area is the extension of process table entry.
Fields of process table entry:
State field
User ID (UID)
Fields of U Area
Pointer to process table entry
File descriptors of all open files
Current directory and current root
I/O parameters
Process and file size limit
Kernel can directly access fields of the U Area of the
executing process but not of the U Area of other
processes
Process Table
• Process table: an entry in process table has the following
information:
process state:
A. running in user mode or kernel mode
B. Ready in memory or Ready but swapped
C. Sleep in memory or sleep and swapped
PID: process id
UID: user id
scheduling information
signals that is sent to the process but not yet handled
a pointer to per-process-region table
• There is a single process table for the entire system
14
Process Region
table table
text
data
stack
Active process
Reference
text count = 2
data
stack
Per-process
region table 15
Introduction to system concepts
1. File Subsystem
2. Process control subsystem
3. Kernel data structures
File subsystem
a) File table
b) User file descriptor table
Process
Concept of a process
-In Unix f first process created when system boots is process0.
-Which then uses fork() system call to create process 1 called as init
process
-Then this process 0 converts itself into just swapper process
-Now process 1 takes charge of all system and has special
relationship with its child…sub child, sub-sub-child…etc.
-Init process becomes most ancestor process for all other processes.
Whenever we execute a program from command prompt kernel load that program in to
RAM and now called as process
Regions of process
1) Text
Memory blocks reserved for both initialized and uninitialized global data
3) Stack
- Local variables
- Address of previous frame
- return address of the call
- parameters of function
2) Process Table
4) Region table
-State of process
-Values of global variables in the process
- Values of CPU registers that are used by process
-Values in its process table slot
-Its u area
-Contents of its user stack
-Contents of its kernel stack
Context switch
sleep(event):
Wakeup()
}
Again set condition true;
For wakeup
Set condition to false
Wakeup(event: the condition becomes false)
Kernel data structures
The global data structures of kernel are usually “tables”(arrays ) of fixed size
rather than dynamic allocated size.