Podcast
Questions and Answers
Which of the following best describes the primary role of the stack within the memory layout of a C program?
Which of the following best describes the primary role of the stack within the memory layout of a C program?
- Storing global variables that are accessible throughout the program.
- Managing dynamically allocated memory during program execution.
- Holding temporary data such as function parameters, return addresses, and local variables. (correct)
- Containing the program's executable code and instructions.
What is the main purpose of the 'Heap' in the memory layout of a C program?
What is the main purpose of the 'Heap' in the memory layout of a C program?
- To manage memory that is dynamically allocated during the program's runtime. (correct)
- To store global variables used by the program.
- To store the program's instructions that are being executed.
- To keep track of the current instruction being executed.
Which of the following pieces of information is NOT typically stored within a Process Control Block (PCB)?
Which of the following pieces of information is NOT typically stored within a Process Control Block (PCB)?
- Memory-management information, including memory allocated to the process.
- The process's current state (e.g., running, waiting).
- The amount of free disk space available on the system. (correct)
- CPU scheduling information, such as priority and queue pointers.
In the context of process management, what does the 'program counter' within a Process Control Block (PCB) indicate?
In the context of process management, what does the 'program counter' within a Process Control Block (PCB) indicate?
A process is in the 'waiting' state. What is the MOST likely reason for this?
A process is in the 'waiting' state. What is the MOST likely reason for this?
Which process state signifies that a process has completed its execution?
Which process state signifies that a process has completed its execution?
Considering the process states, which transition would occur when a running process's allocated time expires?
Considering the process states, which transition would occur when a running process's allocated time expires?
A new process is 'admitted'. According to analogy, what state would that process be in?
A new process is 'admitted'. According to analogy, what state would that process be in?
In a multitasking operating system, what is the key differentiator that distinguishes it from multiprogramming?
In a multitasking operating system, what is the key differentiator that distinguishes it from multiprogramming?
When a program is loaded into memory and becomes an active entity, what is it then referred to as?
When a program is loaded into memory and becomes an active entity, what is it then referred to as?
Which of the following scenarios best illustrates the concept of one program being executed as several processes?
Which of the following scenarios best illustrates the concept of one program being executed as several processes?
In the context of operating systems, what is the 'text section' of a process primarily responsible for?
In the context of operating systems, what is the 'text section' of a process primarily responsible for?
Which of the following scenarios accurately describes the concept of multiprocessing?
Which of the following scenarios accurately describes the concept of multiprocessing?
What is the primary difference between a program and a process?
What is the primary difference between a program and a process?
Consider a scenario where a user launches two instances of the same text editor application. How are these instances typically represented in the operating system?
Consider a scenario where a user launches two instances of the same text editor application. How are these instances typically represented in the operating system?
In the context of process management, what does the term 'job' typically refer to in a batch processing system?
In the context of process management, what does the term 'job' typically refer to in a batch processing system?
In a message passing system, what role does the kernel primarily play during message transfer between processes?
In a message passing system, what role does the kernel primarily play during message transfer between processes?
Which of the following is a key performance consideration when choosing between message passing and shared memory in a multi-core system?
Which of the following is a key performance consideration when choosing between message passing and shared memory in a multi-core system?
What are the two fundamental operations provided by an Inter-Process Communication (IPC) facility using message passing?
What are the two fundamental operations provided by an Inter-Process Communication (IPC) facility using message passing?
Which factor is most likely to influence the suitability of message passing for inter-process communication?
Which factor is most likely to influence the suitability of message passing for inter-process communication?
When establishing a communication link for message passing between two processes, which consideration is crucial for determining the communication pattern?
When establishing a communication link for message passing between two processes, which consideration is crucial for determining the communication pattern?
What is the primary purpose of a socket in the context of operating systems?
What is the primary purpose of a socket in the context of operating systems?
If a message is sent to the IP address 192.168.1.1:8080
, what does 8080
signify?
If a message is sent to the IP address 192.168.1.1:8080
, what does 8080
signify?
Which range of port numbers is typically reserved for well-known services?
Which range of port numbers is typically reserved for well-known services?
What is the significance of the IP address 127.0.0.1
?
What is the significance of the IP address 127.0.0.1
?
In the context of Remote Procedure Calls (RPC), what is the role of a 'stub'?
In the context of Remote Procedure Calls (RPC), what is the role of a 'stub'?
What is the purpose of External Data Representation (XDR) in remote procedure calls?
What is the purpose of External Data Representation (XDR) in remote procedure calls?
In the context of inter-process communication, what is a primary difference between local procedure calls and remote procedure calls?
In the context of inter-process communication, what is a primary difference between local procedure calls and remote procedure calls?
What is the key consideration when determining the nature of communication through a pipe?
What is the key consideration when determining the nature of communication through a pipe?
Which of the following is NOT a typical advantage of using separate processes for browser rendering (one process per website)?
Which of the following is NOT a typical advantage of using separate processes for browser rendering (one process per website)?
Which of the following scenarios exemplifies a situation where cooperating processes would be most beneficial?
Which of the following scenarios exemplifies a situation where cooperating processes would be most beneficial?
A system uses shared memory for interprocess communication. What is the main responsibility of the user processes when accessing the shared memory region?
A system uses shared memory for interprocess communication. What is the main responsibility of the user processes when accessing the shared memory region?
In the context of interprocess communication (IPC), which of the following is a primary disadvantage of using shared memory compared to message passing?
In the context of interprocess communication (IPC), which of the following is a primary disadvantage of using shared memory compared to message passing?
Which of the following inter-process communication (IPC) methods does NOT require explicit shared access to memory?
Which of the following inter-process communication (IPC) methods does NOT require explicit shared access to memory?
A system is designed such that processes communicate by exchanging messages. What is a key advantage of this approach compared to using shared memory?
A system is designed such that processes communicate by exchanging messages. What is a key advantage of this approach compared to using shared memory?
Which of the following scenarios is most suitable for using shared memory as an interprocess communication mechanism?
Which of the following scenarios is most suitable for using shared memory as an interprocess communication mechanism?
Consider two processes, P1 and P2, that need to communicate. P1 produces data that P2 consumes. If message passing is used for IPC, how does the operating system facilitate this interaction?
Consider two processes, P1 and P2, that need to communicate. P1 produces data that P2 consumes. If message passing is used for IPC, how does the operating system facilitate this interaction?
What is the most likely consequence of having only CPU-bound processes in a system?
What is the most likely consequence of having only CPU-bound processes in a system?
Why might a time-sharing system, like UNIX or Microsoft Windows, opt not to employ a long-term scheduler?
Why might a time-sharing system, like UNIX or Microsoft Windows, opt not to employ a long-term scheduler?
In the context of operating systems, what is 'swapping,' often managed by the medium-term scheduler?
In the context of operating systems, what is 'swapping,' often managed by the medium-term scheduler?
Why is context-switch time considered overhead in an operating system?
Why is context-switch time considered overhead in an operating system?
How does the complexity of the operating system and the process control block (PCB) affect context-switch time?
How does the complexity of the operating system and the process control block (PCB) affect context-switch time?
What is the role of the exit()
system call in process management?
What is the role of the exit()
system call in process management?
What is the significance of the process identifier (PID) in operating systems?
What is the significance of the process identifier (PID) in operating systems?
When a parent process creates a child process, which of the following resource sharing options is NOT typically available?
When a parent process creates a child process, which of the following resource sharing options is NOT typically available?
In terms of execution, what are the typical options available to a parent process after creating a child process?
In terms of execution, what are the typical options available to a parent process after creating a child process?
In the context of process creation in UNIX-like systems, what is the role of the fork()
system call?
In the context of process creation in UNIX-like systems, what is the role of the fork()
system call?
Following a fork()
call in UNIX, what is the typical purpose of using the exec()
system call?
Following a fork()
call in UNIX, what is the typical purpose of using the exec()
system call?
In a system utilizing medium-term scheduling, what is the primary motivation for removing a process from memory and storing it on disk?
In a system utilizing medium-term scheduling, what is the primary motivation for removing a process from memory and storing it on disk?
The init
process in Linux, with a PID of 1, serves what critical function?
The init
process in Linux, with a PID of 1, serves what critical function?
Which of the following scenarios would most likely result in the longest context switch time?
Which of the following scenarios would most likely result in the longest context switch time?
Which operation on processes is essential for an operating system to manage the dynamic creation and termination of applications?
Which operation on processes is essential for an operating system to manage the dynamic creation and termination of applications?
Flashcards
Uniprogramming
Uniprogramming
Only one program resides in RAM at a time.
Multiprogramming
Multiprogramming
Multiple processes reside in RAM simultaneously.
Multitasking
Multitasking
Multiple processes from different users reside in RAM.
Multiprocessing
Multiprocessing
Signup and view all the flashcards
Multithreading
Multithreading
Signup and view all the flashcards
Process
Process
Signup and view all the flashcards
Program
Program
Signup and view all the flashcards
Text Section
Text Section
Signup and view all the flashcards
Process Image: Stack
Process Image: Stack
Signup and view all the flashcards
Process Image: Data Section
Process Image: Data Section
Signup and view all the flashcards
Process Image: Heap
Process Image: Heap
Signup and view all the flashcards
PCB (Process Control Block)
PCB (Process Control Block)
Signup and view all the flashcards
Process State
Process State
Signup and view all the flashcards
Process State: New
Process State: New
Signup and view all the flashcards
Process State: Running
Process State: Running
Signup and view all the flashcards
Process State: Waiting
Process State: Waiting
Signup and view all the flashcards
Message Passing
Message Passing
Signup and view all the flashcards
Message Passing Steps
Message Passing Steps
Signup and view all the flashcards
Message Size
Message Size
Signup and view all the flashcards
Message Passing Overhead
Message Passing Overhead
Signup and view all the flashcards
Link Directionality
Link Directionality
Signup and view all the flashcards
Website Renderer Isolation
Website Renderer Isolation
Signup and view all the flashcards
Cooperating Process
Cooperating Process
Signup and view all the flashcards
Why Cooperating Processes?
Why Cooperating Processes?
Signup and view all the flashcards
Two IPC Models?
Two IPC Models?
Signup and view all the flashcards
Shared Memory (IPC)
Shared Memory (IPC)
Signup and view all the flashcards
Shared Memory Characteristics
Shared Memory Characteristics
Signup and view all the flashcards
Message Passing (IPC)
Message Passing (IPC)
Signup and view all the flashcards
What is a Socket?
What is a Socket?
Signup and view all the flashcards
What is a Port?
What is a Port?
Signup and view all the flashcards
Socket Pair
Socket Pair
Signup and view all the flashcards
Well-known Ports
Well-known Ports
Signup and view all the flashcards
Loopback Address
Loopback Address
Signup and view all the flashcards
Remote Procedure Call (RPC)
Remote Procedure Call (RPC)
Signup and view all the flashcards
RPC Stubs
RPC Stubs
Signup and view all the flashcards
What are Pipes?
What are Pipes?
Signup and view all the flashcards
Unbalanced System (CPU-Bound)
Unbalanced System (CPU-Bound)
Signup and view all the flashcards
Medium-Term Scheduling
Medium-Term Scheduling
Signup and view all the flashcards
Context Switch
Context Switch
Signup and view all the flashcards
Process Context
Process Context
Signup and view all the flashcards
Context-Switch Time
Context-Switch Time
Signup and view all the flashcards
Process Identifier (PID)
Process Identifier (PID)
Signup and view all the flashcards
Tree of Processes
Tree of Processes
Signup and view all the flashcards
fork() System Call
fork() System Call
Signup and view all the flashcards
exec() System Call
exec() System Call
Signup and view all the flashcards
exit() System Call
exit() System Call
Signup and view all the flashcards
Parent Process
Parent Process
Signup and view all the flashcards
Child Processes
Child Processes
Signup and view all the flashcards
init Process
init Process
Signup and view all the flashcards
Resource Sharing Options
Resource Sharing Options
Signup and view all the flashcards
Execution Options
Execution Options
Signup and view all the flashcards
Study Notes
Chapter 3: Processes
- The text covers process concepts, process scheduling, operations on processes, interprocess communication (IPC), examples of IPC systems, and communication in client-server systems.
Important Terms
- Uniprogramming: RAM implies a single process.
- Multiprogramming: RAM implies multiple processes.
- Multitasking: RAM implies multiple processes that are belonging to different users.
- Multiprocessing: Implies multiple CPUs or microprocessors.
- Multithreading: Implies multiple threads inside a process.
Process Concept
- An operating system executes a variety of programs, including batch systems (jobs) and time-shared systems (user programs/tasks).
- The textbook uses the terms job and process almost interchangeably.
- A process is a program in execution, which must progress in a sequential fashion.
- A program is a passive entity stored on disk like an executable file, while a process is active.
- A program becomes a process when its executable file is loaded into the system memory.
- Execution of a program starts via GUI mouse clicks, command line entry of its name, and other methods.
- One program can have several processes, with multiple users executing the same program.
Process in Memory
- A process has multiple parts:
- The text section, known as program code with the current activity, includes the program counter and processor registers.
- The Stack contains temporary data like function parameters, return addresses, and local variables
- The Data section contains global variables
- The Heap contains memory dynamically allocated during run time.
Process Control Block (PCB)
- The PCB or task control block is associated to each process.
- Includes the process state (running, waiting, etc.) and the process identification number.
- Contains the program counter showing the location of instruction to next execute.
- It keeps CPU registers that contains the contents of all process-centric registers.
- It has CPU scheduling information like priorities, scheduling queue pointers.
- The PCB uses memory-management information which is the memory allocated to the process.
- Other information include accounting which has the CPU used, clock time elapsed since start, or time limits.
- The PCB stores the I/O status information for I/O devices allocated to process, list of open files
Process State transition
- As a process executes, it changes through different states.
- new: The process is being created.
- running: Instructions are being executed.
- waiting: The process is waiting for some event to occur.
- ready: The process is waiting to be assigned to a processor.
- terminated: The process has finished execution.
- Analogy for process is a hopsital - New admissions, waiting hall, Dr Checkup , laboratories etc..
Process Representation
- In Linux, a C structure "task struct" represents a process:
- includes the PID (process identifier) and the state of the process.
- contains scheduling information, a pointer to the parent process, and a list of children processes
- Files shows a list of open files
- mm struct shows the address space for this process
Threads
- Up to this poing processes had single threads of execution.
- Consider having multiple program counters per process.
- Multiple threads of control allow multiple locations to execute at once.
- Processes require storage for thread details and multiple program counters in the PCB.
Process Scheduling
- Process scheduling maximizes CPU use and quickly switches processes onto the CPU for time-sharing.
- The Process scheduler selects among available processes for next execution on CPU on a scheduling queue.
- Scheduling queues includes jobs that sets all the processes in the system.
- Ready queue is set of all processes residing in main memory, ready and waiting to execute.
- A new process is initially put in the ready queue and waits there dispatch.
- Device queues are sets of processes waiting for an I/O device.
- Processes migrate among the various queues.
Schedulers
- Short-term scheduler (or CPU scheduler) selects which process should be executed next and allocates CPU.
- Sometimes the only scheduler in a system, and it is invoked frequently in milliseconds, so it must be fast.
- Long-term scheduler (or job scheduler) selects which processes should be brought into the ready queue.
- It is invoked infrequently in seconds or minutes, and it may be slow, controlling the degree of multiprogramming.
- Processes can be described as either I/O-bound that that spend more time doing I/O than computations, or
- CPU-bound processes spend more time doing computations with few very long CPU bursts.
- Long-term scheduler benefit good process mix.
- Time-sharing systems like UNIX and Microsoft Windows often do not have a long-term scheduler.
- A medium-term scheduler is added if the degree of multiple programming needs to decrease via swapping.
Context Switch
- When the CPU switches to another process, the system must save the state of the old process and load the saved state for the new process within a context switch.
- Overhead occurs with context-switch time, and the system does no useful work while switching.
- The more complex the OS and the PCB, the longer the context switch.
- Time is dependent on hardware support with some providing multiple sets of registers per CPU to load multiple contexts at once.
Operations on Processes
- An OS provides mechanisms for process creation and termination.
Process Creation
- A parent process creates child processes which in turn create other processes, forming a tree.
- Processes are identified and managed by a process identifier (pid).
- There are different resource sharing options that can occur.
- Including Parent and children sharing all resources.
- or Children share subset of parent's resources.
- Or Parent and child share no resources.
- Execution options has the parent and children executing concurrently.
- Or the parent should waits until children terminate
UNIX examples
- fork() system calls creates a new process.
- exec() system call is used after a fork() to replace the process' memory space with a new program.
Process Termination
- A process executes the last statement causing exit() system call.
- Then the process will return status data from the terminated child to parent via wait().
- The OS deallocates the processes resources.
- A parent may terminate the execution of children processes using the abort() system call for reasons like:
- Child has exceeded allocated resources.
- Task assigned to child is no longer required.
- The parent is exiting, and the operating systems may not allow a child to continue if its parent terminates.
- Some operating systems do not release to exist child if its parent has been terminated.
- If a process terminates for cascading termination, then all its children (all the way down) must also be terminated.
- The parent process may wait for termination of a child process by using the wait() system call to return status information
- If no parent calling wait() on a terminated child process the program is called a zombie
- If a parent terminates and does not call wait then the process is an orphan.
- The init process is the root parent process (always has a pid of 1) for all user processes.
Multiprocess Architecture
- Chrome is an example of a multiprocess architecture.
- A design for running multiple processes with the 3 processes:
- Browser process which will manages user interface, disk, and network I/O.
- A Renderer process deals with rendering of web pages, HTML and Javascript.
- new renderer is created for each website opened running in a sandbox to minimize the effect of security exploits.
- Plug-in process for each type of plug-in
Interprocess Communication
- Processes within a system are independent or cooperating
- Independent processes can affect or be affected by the execution of another process.
- Cooperating processes is reverse.
- Reason to use:
- Information sharing
- Computation speedup
- Modularity
- Convenience
- Cooperating processes require interprocess communication (IPC) using two models: Shared and Message passing
- Shared Memory creates processes that exchange information by reading and writing data to the shared region. The communications under the control of the users processes.
- Message Passing takes place by means of messages exchange between the cooperating processes and easier to implement
Message Passing Implementation
- If processes P and Q communicate, establish communication link and exchange messages via send/receive.
- Links can be through Direct or indirect communication, Synchronous or asynchronous, or Automatic or explicit buffering
Direct Communication:
- Proccessess must name or know each ther.
- use send(P, message) and recieve (Q,message)
- Links established automatically
- links associcated with one pair
- there is usually one link that is bi-directional
Indirect Communication
- Are directed and received from mailboxes
- Each has a unique ID
- Processes can communicate only sharing mailbox
- Link established with share mailbox
- operations are send (A, message) and recieve (A,message)
- is the size is either fixed or variable
###Synchronization during message passing
- Message passing may be either blocking (synchronous) or non-blocking asynchronous
Blocking:
- sennder is blocked during blocking sedn till message arrives
- receiver blocked during blocking receive till message is ready
Non Blocking: - sender sends and continue - valid messagw/ or null message -
Buffering
- Uses queues of messages attached to the link of 3 ways implemented :
- Has has no queues - zero capacity so must wait for reciever
- Finite que length - of n messages -sender if full link
- infinite length - unbounded capacity where sender never waits
Producer-Consumer Problem
- This focuses on a producer process that consumes information that is consumed by a consumer
- If is unrestricted like unbounded-buffer there is no limit on size
- If is constricted like bounded-buffer, it assumes a fixed size
Client-Server Systems
- These methods are for inter-process communication where processes are on different computers.
- Shared memory and Message passing can't work for this type of client-server communication. so methods used includes:
- Sockets, Remote Procedure Calls, Pipes, and Remote Method Invocation (Java)
Sockets
- Is is endpoint for communication that starts at the message packet.
- Is between hosts
- the socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8
- ports below 1024 are well known
- special adress is 127.0.0.1
Remote Procedure Calls
- RPC absstracts process between processes
- uses ports for service
- stubs are cleint proxxies
- calls marhsalls
- microsofts version called MIDL
Data representations with a EDL
- big endian and little endian
- Messages are can only be delivered once
- OS provides a matchmarker service to contect client and server
Pipes
- Acts as conduit allowing processes to communicate
- Communication can be uni/birectional
- used for parent-child relation
- Ordinary pipes are used only for within process creating. Parent create pipe to communicate to child.
- windows calls these anonymous pipes
- Named pipes are accessed with no parent-child relationship.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.