Dragon Book Chapter 3 Til 3.3
Dragon Book Chapter 3 Til 3.3
Dragon Book Chapter 3 Til 3.3
In the early days of computing, systems were capable of executing only one program
at a time. This program wielded complete control over the system and could access all
its resources without restriction. However, this approach hindered system efficiency and
capability.
Introduction of Processes
Purpose of Processes
Components of a System
1. Operating System Processes: These processes execute system code and handle critical
system tasks.
2. User Processes: These processes execute user code and represent tasks initiated by
users.
Concurrent Execution
• Multiplexing CPU: In a multitasking environment, multiple processes can execute
concurrently. The CPU switches between processes, a technique known as CPU
multiplexing, which boosts overall productivity.
While the primary responsibility of the operating system is executing user programs, it
also performs various system tasks. These tasks are executed as separate operating
system processes, ensuring efficient management outside the kernel.
Conclusion
Definition of a Process
Multiplicity of Processes
Even if multiple processes are associated with the same program, they are
considered separate execution sequences. For example, multiple users may
run different instances of the same program simultaneously. Each of these
instances constitutes a separate process, with variations in data, heap, and
stack sections.
A process can itself serve as an execution environment for other code. For
instance, the Java Virtual Machine (JVM) executes as a process, interpreting
and executing Java code. This setup allows for the execution of Java programs
within the JVM environment.
Process State
These states may vary across operating systems, but the underlying concepts
remain consistent.
• Process State
• Program Counter
• CPU Registers
• CPU-Scheduling Information
• Memory-Management Information
• Accounting Information
• I/O Status Information
The PCB serves as a repository for information that may vary from process to
process.
Threads
Modern operating systems extend the process concept to allow for multiple
threads of execution within a single process. This feature enables a process
to perform more than one task simultaneously, which is particularly
advantageous on multicore systems. The PCB is expanded to include
information for each thread, and other system changes are made to support
threads.
Representation in Linux
Process Scheduler
Purpose:
Scheduling Queues
Types:
Queueing Diagram
• Representation: A visual depiction of process scheduling, illustrating the flow
of processes through various queues and resources in the system.
Process State Transition
States and Transitions:
Schedulers
Types:
Context Switch
Process Context:
Process Creation
• fork() System Call: In UNIX-like systems, the fork() system call is used to
create a new process by duplicating the address space of the parent. This
allows both the parent and child processes to continue execution
independently.
• exec() System Call: After forking, a process may use the exec() system call to
replace its memory space with a new program. This mechanism enables
seamless communication between parent and child processes before they
diverge.
Process Termination
Queued Messages
Message Processing
Information Retention
- **Static Variables**: Information obtained in one message and required for
processing subsequent messages is typically stored in static variables within
the window procedure.
Conclusion