Podcast
Questions and Answers
What happens when a parent process terminates?
What happens when a parent process terminates?
When does a child process entry get removed from the process table?
When does a child process entry get removed from the process table?
What is the status of a process that becomes an orphan?
What is the status of a process that becomes an orphan?
What triggers a child process to become a zombie?
What triggers a child process to become a zombie?
Signup and view all the answers
What are the reasons for cooperating processes according to the text?
What are the reasons for cooperating processes according to the text?
Signup and view all the answers
Which model of interprocess communication (IPC) involves shared memory?
Which model of interprocess communication (IPC) involves shared memory?
Signup and view all the answers
What is a process in an operating system?
What is a process in an operating system?
Signup and view all the answers
Which of the following is NOT stored in the Process Control Block (PCB)?
Which of the following is NOT stored in the Process Control Block (PCB)?
Signup and view all the answers
In the context of child process termination reasons, what does cascading termination refer to?
In the context of child process termination reasons, what does cascading termination refer to?
Signup and view all the answers
What information does the Process Control Block (PCB) store about each process?
What information does the Process Control Block (PCB) store about each process?
Signup and view all the answers
Regarding process scheduling, what does 'priorities' refer to?
Regarding process scheduling, what does 'priorities' refer to?
Signup and view all the answers
What term describes the status of a process after it has completed execution?
What term describes the status of a process after it has completed execution?
Signup and view all the answers
What is the state of a process when it is waiting for some event to occur?
What is the state of a process when it is waiting for some event to occur?
Signup and view all the answers
Which type of process spends more time doing I/O than computations?
Which type of process spends more time doing I/O than computations?
Signup and view all the answers
What happens to the process state when it has finished execution?
What happens to the process state when it has finished execution?
Signup and view all the answers
Which data structure represents the context of a process in modern systems?
Which data structure represents the context of a process in modern systems?
Signup and view all the answers
In process scheduling, when CPU switches to another process, what must the system do?
In process scheduling, when CPU switches to another process, what must the system do?
Signup and view all the answers
What term describes a situation where a parent process terminates, causing all its child processes to also terminate?
What term describes a situation where a parent process terminates, causing all its child processes to also terminate?
Signup and view all the answers
Study Notes
Process
- A program in execution is called a process, whereas a program is a passive entity stored on disk as an executable file.
- A program becomes a process when the executable file is loaded into memory.
Process in Memory
- Temporary data storage is used when invoking functions, including function parameters and local variables.
- Dynamically allocated memory is also used.
- Global variables are stored in memory.
- The executable code is stored in memory.
Process Control Block (PCB)
- PCB stores all information associated with each process, also known as the task control block.
- Process state (running, waiting, etc.) is stored in the PCB.
- Process number (Process ID) is stored in the PCB.
- CPU registers and program counter contents are stored in the PCB.
- CPU scheduling information, such as priorities and scheduling queue pointers, is stored in the PCB.
- Memory-management information, such as memory allocated to the process, is stored in the PCB.
Process Representation in Linux
- In Linux, processes are referred to as tasks.
- Each process is represented by a C structure called task_struct.
- The task_struct contains information such as process ID, state, time slice, parent, children, files, and memory management.
Process State
- A process can be in one of five states: new, ready, running, waiting, or terminated.
- New: the process is being created.
- Ready: the process is waiting to be assigned to a processor.
- Running: instructions are being executed.
- Waiting: the process is waiting for some event to occur.
- Terminated: the process has finished execution.
Types of Processes
- Processes can be categorized as either I/O-bound or CPU-bound.
- I/O-bound process: spends more time doing I/O than computations, with many short CPU bursts.
- CPU-bound process: spends more time doing computations, with few very long CPU bursts.
Threads
- Modern systems allow a process to have multiple threads associated with it.
- These threads can execute concurrently.
- More on threads will be discussed in the next chapter.
Context Switch
- Context of a process is represented in the PCB.
- When the CPU switches to another process, the system must save the context of the old process and load the context of the new process.
- If a parent process terminates, its entry is removed from the table.
- If a child process terminates, its entry is removed from the table only after the parent process invokes a wait().
- If no parent is waiting, the process is a zombie.
- If the parent terminated without invoking wait(), the process is an orphan.
Process Scheduling
- Process scheduling will be discussed in detail in Chapter 5.
Interprocess Communication (IPC)
- Processes within a system may be independent or cooperating.
- Cooperating processes need interprocess communication (IPC) for reasons such as information sharing, computation speedup, modularity, and convenience.
- There are two models of IPC: shared memory and message passing.
IPC – Shared Memory
- Shared memory is an area of memory shared among the processes that wish to communicate.
- The communication is under the control of the user processes, not the operating system.
- Shared memory is more complicated to set up and does not work well across multiple computers.
- It is used for sharing large amounts of data.
- Major issues with shared memory include synchronizing process actions when accessing shared memory.
IPC – Message Passing
- Message passing is a capability provided by the operating system.
- The operating system provides message passing capability.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge of process states in operating systems with this quiz. Learn about how processes change state as they execute, from 'new' to 'waiting' to 'terminated'. Explore structures like task_struct and files_struct in the context of process management.