study_os_l2
"/home/yossef/notes/Su/os/study_os_l2.md"
path: Su/os/study_os_l2.md
- **fileName**: study_os_l2
- **Created on**: 2025-04-05 14:54:13
what is a process?
Is an active entity which is program execution (load into main memory for
execution)
process need a resources like cpu and ram and storage and else for execution
What is thread?
Is a unit for execution with in a process, a process can have a single thread
or multiple threads
single thread process having only one program counter specifying location
for the next instruction that gone execute
multi thread process having only one program counter per threads
(one cpu == one thread)
What is process part?
- stack: temporary data like function param, local variable, return value
- heap: memory dynamically allocate (malloc = c lang)
- data section: global variable
- current activity: program counter, process register
- the program code(text section)
What are the five state of process?
- new
- ready
- running
- waiting
- terminated
What is the information associated with process control block(process)?
- process id
- process state
- program counter
- cpu register
- cpu schedule information
- memory management information
- accounting information
- I/O status information
What is process schedule?
Select from available processes for the next execution
What is process dispatcher?
Response for the process state changing
Short-term scheduler (or CPU scheduler) –
selects which process should be executed next and allocates CPU
- Sometimes the only scheduler in a system
- Short-term scheduler is invoked frequently (milliseconds) (must be fast)
Long-term scheduler (or job scheduler) –
selects which processes should be brought into the ready queue
- Long-term scheduler is invoked infrequently (seconds, minutes) (may be
slow) - The long-term scheduler controls the degree of multiprogramming
Operating System Concepts – 9th Edition
Medium-term scheduler
- Remove process from memory, store on disk, bring back in from disk to
continue execution swapping
Independent process cannot affect or be affected by the execution of another
process
Cooperating process can affect or be affected by other processes, including
What is Reasons for cooperating processes:
- Information sharing: to share a source of information by several process
or tasks or users - Computation speed-up: when dividing a task into sub-tasks (processes) to be
accomplished faster - Modularity: designing a system by dividing it into separate modules (processes)
- Convenience: a system with cooperative tasks (processes) will more convenient
to users
Cooperating processes need inter-process communication to exchange
data and information
What are Two models of IPC(inter-process communication) are:
- Shared memory: process can read and write data and information to the
shared memory area - Message passing
Message Passing Mechanism is for cooperating processes to communicate
and to synchronize their actions by exchanging messages between each
other through the Kernel which allocates registers that form a Message Queue
for cooperating processes
Blocking is considered synchronous
- Blocking send -- the sender is blocked until the message is received by
recipient process or mailbox. - Blocking receive -- the receiver is blocked until a message is available
Non-blocking is considered asynchronous
- Non-blocking send -- the sender sends the message and continue or
resumes operation - Non-blocking receive -- the receiver receives either a valid message or a
null message
Messages are exchanged by communicating processes and reside in a
temporary queue (Buffering). This queue (Buffer) can be implemented in three ways:
1. Zero-Capacity Buffer
- Maximum length is zero.
- Cannot have any messages waiting (residing) in it.
- The sender must be blocked until the message is received (Blocking send).
2. Bounded Buffer
- Has a finite length (n).
- At most n messages can be waiting (residing) in it.
- As long as the buffer is not full, it can store messages and the
sender can continue execution. - If the buffer is full, the sender must be blocked until there is
enough space in the buffer.
3. Unbounded Buffer
-
Has infinite capacity.
-
Can store an unlimited number of messages.
-
The sender is never blocked.
continue:./study_os_l3.md
before:./study_os_l1.md