1/48
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Process
is the execution of a program that performs the actions specified in that program.
Text section
comprises the compiled program code, read in from non-volatile storage when the program is launched.
Data section
stores global and static variables, allocated and initialized prior to executing main.
Heap
is used for dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc.
Stack
is used for local variables.
Stack overflow
If stack and heap ever meet, then either a __________ error will occur, or else a call to new or malloc will fail due to insufficient memory available.
Process Management
involves various tasks like creation, scheduling, termination of processes, and a dead lock.
Process states
a condition of the process at a specific instant of time. It also defines the current position of the process.
New
process is created when a specific program calls from secondary memory/hard disk to primary memory / RAM.
Ready
the process should be loaded into the primary memory which is ready for execution.
Running
the process is in execution.
Waiting
the process cannot run at the moment, because it is waiting for some resources to become available or for some event to occur.
Terminated or Halted
process has completed.
Context switching
is the process of saving the context of one process and loading the context of another process.
In simple terms, it is like loading and unloading the process from running state to ready state.
Context switching
happens when:
When a high-priority process comes to ready state (i.e. with higher priority than the running process)
An interrupt occurs
User and kernel mode switch (though, this is not necessary)
Preemptive CPU scheduling is used.
Context switching
process of saving and restoring the state of a CPU so that multiple processes can share a single CPU resource.
Context switching
are triggered by the OS scheduler, which decides which process should run next based on scheduling policies.
Mode switch, or privilege level switch
refers to the transition of the CPU from one privilege level to another.
Mode switch, or privilege level switch
occurs when CPU privilege level is changed, for example when a system call is made, or a fault occurs.
fork()
duplicates the current process to create a new one in Unix-like operating system.
spawn()
creates a new process or thread, often at a higher level of abstraction, in various programming languages and environments.
Initialization
Operating system prepares for process creation.
Allocation of Process ID (PID)
Unique identifier assigned to the new process.
Memory Allocation
Space allocated for code, data, heap, and stack.
Creation of Process Control Block (PCB)
Data structure initialized to manage the process.
Scheduling
Process scheduled for execution based on OS scheduling policy.
Execution
Process begins executing its instructions.
fork()
to create a child process
exit()
to terminate a child process
wait()
parent process waits for a child process
exec()
process overwrites itself with another executable program
Process termination
occurs when the exit system is called.
Deallocated
When a process exits, resources, memory, and I/O devices are all _________.
Multiple threads
are contained within a process.
Thread
is the segment of a process which means a process can have multiple threads.
Multithreading
The ability of a program to execute multiple threads concurrently within a single process, allowing for parallel execution of tasks and efficient utilization of resources is called ___________.
Long-term scheduler
(a.k.a. job scheduler) – selects process from the queue and puts them in the memory for it to be executed.
Short-term scheduler
(a.k.a. CPU scheduler) – manages process that are ready to execute and allocates CPU to one of them.
Medium-term scheduler
(a.k.a. swapper) – manages the swapping of processes in the main memory and secondary memory.
Process scheduling
is the process manager’s ability to remove running process from the CPU and selecting another process through a particular strategy.
Main goal of Process Scheduling
keep the CPU occupied all the time; and
provide the least amount of response time for every program.
Two (2) scheduling categories
Non-preemptive scheduling
Preemptive scheduling
Arrival Time (AT)
time at which the process arrives in the ready queue.
Completion Time
time at which processes completes its execution.
Burst Time (BT)
time require by a process for CPU execution.
Turn Around Time (TT or TaT)
time difference between completion time and arrival time.
Waiting Time (WT)
time difference between turn around time and burst time.
Non-Preemptive Algorithms
First Come First Serve (FCFS)
Shortest Job First (SJF)
Non-Preemptive Priority (NPP)
Preemptive Algorithms
Round Robin (RR)
Shortest Remaining Time First (SRTF)
Preemptive Priority (PP)