Podcast
Questions and Answers
Which of the following best describes a 'process' in the context of operating systems?
Which of the following best describes a 'process' in the context of operating systems?
- A set of computer hardware components.
- A program in execution, with its associated resources. (correct)
- A section of code within a program that performs a specific task.
- A type of file that stores data.
In what order must process execution progress?
In what order must process execution progress?
- Parallel fashion
- Concurrent fashion
- Sequential fashion (correct)
- Random fashion
Which of the following is NOT typically included within a process?
Which of the following is NOT typically included within a process?
- Stack
- Operating system kernel (correct)
- Data section
- Program counter
What condition may cause a 'memory segmentation fault'?
What condition may cause a 'memory segmentation fault'?
What happens to a process in the 'waiting' state?
What happens to a process in the 'waiting' state?
Which of the following is the most accurate description of the 'ready' state of a process?
Which of the following is the most accurate description of the 'ready' state of a process?
Why is the Process Control Block (PCB) stored in a protected memory area?
Why is the Process Control Block (PCB) stored in a protected memory area?
What kind of information is stored in a Process Control Block (PCB)?
What kind of information is stored in a Process Control Block (PCB)?
How does adding more memory affect swapping?
How does adding more memory affect swapping?
If a system has enough RAM, under what condition will it not swap?
If a system has enough RAM, under what condition will it not swap?
What is the primary function of a 'job queue' in process scheduling?
What is the primary function of a 'job queue' in process scheduling?
What is the role of the 'ready queue' in process scheduling?
What is the role of the 'ready queue' in process scheduling?
Which of the following best describes how processes move through queues?
Which of the following best describes how processes move through queues?
Which statement is most accurate about processes and memory?
Which statement is most accurate about processes and memory?
What is the primary difference between a 'long-term scheduler' and a 'short-term scheduler'?
What is the primary difference between a 'long-term scheduler' and a 'short-term scheduler'?
Which of the following best describes the role of the 'medium-term scheduler'?
Which of the following best describes the role of the 'medium-term scheduler'?
If a short-term scheduler is invoked very frequently, what is its requirement?
If a short-term scheduler is invoked very frequently, what is its requirement?
What is the main characteristic of an I/O-bound process?
What is the main characteristic of an I/O-bound process?
What does 'context switching' involve?
What does 'context switching' involve?
What is a key implication of context-switch time?
What is a key implication of context-switch time?
How are processes typically identified and managed by the operating system?
How are processes typically identified and managed by the operating system?
During process creation what resources can a parent and child process share?
During process creation what resources can a parent and child process share?
In the context of process creation in UNIX-like systems, what is the purpose of the fork()
system call?
In the context of process creation in UNIX-like systems, what is the purpose of the fork()
system call?
What happens after a fork()
is called?
What happens after a fork()
is called?
In UNIX-like systems, what function replaces the process' memory space with a new program after using a fork()
?
In UNIX-like systems, what function replaces the process' memory space with a new program after using a fork()
?
Under what circumstances might a parent process terminate a child process?
Under what circumstances might a parent process terminate a child process?
What is 'cascading termination'?
What is 'cascading termination'?
What best describes 'independent' processes?
What best describes 'independent' processes?
What is the main purpose of Interprocess Communication (IPC)?
What is the main purpose of Interprocess Communication (IPC)?
What are the two models of IPC?
What are the two models of IPC?
In the context of the Producer-Consumer problem, what happens when using a 'bounded-buffer'?
In the context of the Producer-Consumer problem, what happens when using a 'bounded-buffer'?
In message passing, what is required if two processes P and Q, wish to communicate?
In message passing, what is required if two processes P and Q, wish to communicate?
What is a characteristic of 'direct communication' in message passing?
What is a characteristic of 'direct communication' in message passing?
In the context of message passing, how does 'indirect communication' differ from 'direct communication'?
In the context of message passing, how does 'indirect communication' differ from 'direct communication'?
In Indirect Communication, what happens if P1 sends; P2 and P3 both receive?
In Indirect Communication, what happens if P1 sends; P2 and P3 both receive?
What is blocking in message passing typically referred to as?
What is blocking in message passing typically referred to as?
What is the result of Non-blocking receive?
What is the result of Non-blocking receive?
What is the effect of zero capacity?
What is the effect of zero capacity?
Which of the following describes how communication is handled in Mach?
Which of the following describes how communication is handled in Mach?
Which mechanism is used in Windows XP for message-passing centric interprocess communication?
Which mechanism is used in Windows XP for message-passing centric interprocess communication?
What services listen to well-known ports?
What services listen to well-known ports?
In Remote Procedure Calls, what is the purpose of the stubs?
In Remote Procedure Calls, what is the purpose of the stubs?
What does marshalling refer to?
What does marshalling refer to?
What is a limitation of ordinary pipes?
What is a limitation of ordinary pipes?
Flashcards
What is a Process?
What is a Process?
A program in execution; process execution must progress sequentially.
What is Process State?
What is Process State?
The different stages a process goes through as it executes.
What are the common process states?
What are the common process states?
New, running, waiting, ready, and terminated.
What is Process Control Block (PCB)?
What is Process Control Block (PCB)?
Signup and view all the flashcards
What is the Job Queue?
What is the Job Queue?
Signup and view all the flashcards
What is the Ready Queue?
What is the Ready Queue?
Signup and view all the flashcards
What is the Long-Term Scheduler?
What is the Long-Term Scheduler?
Signup and view all the flashcards
What is the Short-Term Scheduler?
What is the Short-Term Scheduler?
Signup and view all the flashcards
What is a Context Switch?
What is a Context Switch?
Signup and view all the flashcards
What is a Process Identifier (PID)?
What is a Process Identifier (PID)?
Signup and view all the flashcards
What does fork() do?
What does fork() do?
Signup and view all the flashcards
What does exec() do?
What does exec() do?
Signup and view all the flashcards
What is Process Termination?
What is Process Termination?
Signup and view all the flashcards
What is Interprocess Communication (IPC)?
What is Interprocess Communication (IPC)?
Signup and view all the flashcards
What is an Independent process?
What is an Independent process?
Signup and view all the flashcards
What is a Cooperating Process?
What is a Cooperating Process?
Signup and view all the flashcards
What is Unbounded-Buffer?
What is Unbounded-Buffer?
Signup and view all the flashcards
What is Bounded-Buffer?
What is Bounded-Buffer?
Signup and view all the flashcards
What is Direct Communication?
What is Direct Communication?
Signup and view all the flashcards
What is Indirect Communication?
What is Indirect Communication?
Signup and view all the flashcards
Define Blocking Send
Define Blocking Send
Signup and view all the flashcards
Define Blocking Receive
Define Blocking Receive
Signup and view all the flashcards
Define Non-blocking Send
Define Non-blocking Send
Signup and view all the flashcards
Define Non-blocking Receive
Define Non-blocking Receive
Signup and view all the flashcards
What is zero capacity?
What is zero capacity?
Signup and view all the flashcards
What is Bounded capacity?
What is Bounded capacity?
Signup and view all the flashcards
What is Unbounded capacity?
What is Unbounded capacity?
Signup and view all the flashcards
What are Sockets?
What are Sockets?
Signup and view all the flashcards
What is a Remote Procedure Call (RPC)?
What is a Remote Procedure Call (RPC)?
Signup and view all the flashcards
How do remote procedure calls wrok?
How do remote procedure calls wrok?
Signup and view all the flashcards
What is Marshalling?
What is Marshalling?
Signup and view all the flashcards
What are pipes?
What are pipes?
Signup and view all the flashcards
What are ordinary pipes?
What are ordinary pipes?
Signup and view all the flashcards
What are named pipes?
What are named pipes?
Signup and view all the flashcards
Study Notes
Chapter 3: Processes
- Explores processes, process scheduling, operations, interprocess communication (IPC), IPC examples, and client-server communication.
- Introduces processes, their features (scheduling, creation, termination, communication), and client-server system communication.
Process Concept
- Specifies that an OS runs diverse programs, including:
- Batch systems running jobs.
- Time-shared systems running user programs or tasks.
- "Job" and "process" are used interchangeably.
- A process embodies a program in execution, progressing sequentially, and includes; a program counter, stack, and data section.
Process Memory
- Memory for process is segmented into:
- Stack: Instructions may overflow.
- Heap: Dynamic data, new parameters can be stored, writing to unallocated memory may cause segmentation faults.
- Data: Is static
- Text: Is file text
- Processes can crash without affecting the entire system.
Process State
- Processes transition through different states during execution; including
- New: being created.
- Running: instructions are executed.
- Waiting: awaiting an event.
- Ready: awaiting processor assignment.
- Terminated: execution is complete.
Process Control Block (PCB)
- Contains process-specific information such as; state, program counter, CPU registers, scheduling data, and memory management info.
- Also holds accounting and I/O status.
- The PCB resides in protected memory, often at the kernel stack's beginning for safety.
- Swapping slows computers and memory reduces swapping.
- Caching does not use swapping.
- Increased RAM increases batter usage, and needs a good configuration.
Process Scheduling Queues
- Job queue : a set of all processes in the system
- Ready queue: a set of processes residing in main memory as well as ready and waiting to execute
- Device queues: a set of processes waiting for an I/O device
- Processes shift queues but retain their memory location, transitioning between ready and device queues.
Schedulers
- Long-term (job) scheduler: selects processes for the ready queue.
- Short-term (CPU) scheduler: selects and allocates the CPU to the next process.
- The long-term scheduler manages multiprogramming degree.
- Processes are I/O-bound, spending more time on I/O with brief CPU bursts, or CPU-bound, spending more time on computations with long CPU bursts
CPU Context Switch
- Involves saving an old process's state and loading a new one, which introduces overhead as the system does no work during the switch.
- Context is represented in the PCB, and the time for context switching depends on hardware support.
Process Creation
- Happens when parent processes create child processes, forming a process tree in shared memory space.
- Processes are identified and managed via a process identifier (pid).
- Resource Sharing Options
- Sharing all.
- Subsets only.
- No sharing.
- Execution Options
- Parent and children execute concurrently.
- Parent waits for children to terminate.
- Fork creates a duplicate child process and exec replaces a process’ memory space after a fork in UNIX.
Process Termination
- Occurs when a process executes its last statement, requesting OS deletion using "exit".
- The child process can output data to the parent using wait and resources are deallocated by the OS.
- Parents can terminate child execution using abort for; exceeding resources, task completion, or parent exiting.
- Some OSs terminate children upon parent exit, referred to as cascading termination.
Interprocess Communication (IPC)
- Processes include independent or cooperating processes, with cooperation enabling data sharing.
- IPC involves; sharing data, speeding up computation, modularity, and offering convenience.
- IPC models use shared memory or message passing.
Cooperating Processes
- A process that cannot affect or be affected by another is independent.
- A cooperating processing can be affected by another.
- Process cooperation brings; information sharing, computation speed-up, modularity, and convenience.
Producer-Consumer Problem
- Cooperation paradigm where a Producer creates information to be consumed by a Consumer.
- Unbounded-buffer places no restriction on buffer size, whereas bounded-buffer assumes it.
Bounded-Buffer (Shared Memory)
- Employs shared data structures like buffer and variables for in/out management
- A fixed
#define BUFFER_SIZE 10
where Solution only used BUFFER_SIZE - 1
Bounded Buffer Producer/Consumer
- In producer -> wait if no free buffers available, then add item to buffer.
- In consumer -> waits until an item is available, then removes item fro the buffer
Interprocess Communication - Message Passing
- Processes use actions to communicate and synchronise without shared variables.
- Interprocess Communication (IPC) provides operations to
send(message)
of a fixed or variable size andreceive(message)
. - If processes P and Q, seek communication, they must; establish a communication link and then exchange information.
- Implementation uses physical (shared memory, hardware bus) or logical properties, implementing direct or indirect, synchronous or asynchronous, and automatic or explicit buffering.
Implementation Questions
- Are links established?
- Can links be associated with more than two processes?
- How many links are there between process pars?
- What link capacity is there?
- Can the message be fixed or variable?
- Is the link unidirectional or bi-directional?
Direct Communication
- Processes explicitly name each other when exchanging messages.
send (P, message)
sends to process P whilereceive(Q, message)
receives from process Q.
- Communication links are established automatically between one pair, with links that may unidirection but are usually bi-directional
Indirect Communication
- Messages move between mailboxes or ports, which are special repositories; each mailbox has a unique id, processes only communicate if they have share a mailbox.
send(A, message)
sends to mailbox A, andreceive(A, message)
retrieves from A.- Mailboxes link multiple senders and receivers, or one statically associated receiver known as a 'port'.
- Mailboxes are owned by the system and managed by a service.
- Links establish only with shared mailbox; links can involve multiple processes sharing several communication links, which can be unidirectional or bidirectional.
Indirect Communication
- Actions include creating, sending/receiving, and destroying.
send(A, message)
sends to mailbox Areceive(A, message)
retrieves from mailbox A- To solve the problem of P1 sending, with P2 and P3 receiving, solutions include no more than two processes, one process at a time gets allowed actions, or sender gets notified.
Message Passing - Synchronization
- Can be Blocking (synchronous) or Non-Blocking(asynchronous)
- Blocking send: the sender blocks until a message is received
- Blocking receive : the receiver blocks until a message is available
- Non-blocking send: the sender sends the message and continue
- Non-blocking receive: A valid message OR a null message must be received
Buffering
- Queue of messages, implemented in three ways.
- Zero capacity: sender waits for 0 messages(rendezvous)
- Bounded capacity: if finite length N is full, sender must wait
- Unbounded capacity: Sender never waits
IPC Examples (POSIX)
- POSIX shared memory actions include:
- Process creates a shared memory segment.
- Requester must attach.
- Process writes to shared memory using
sprintf(shared memory, "Writing to shared memory");
- Process detaches via
shmdt(shared memory);
IPC Examples (Mach)
- Communication is message based, including system calls.
- Tasks get kernel and notify mailboxes on creation.
- Three system calls are vital for message transfer:
msg_send(), msg_receive(), msg_rpc()
- Mailboxes, which are created with
port_allocate()
, are core for general commuication.
IPC Examples (Windows XP)
- Message-centric passing based on local procedure call (LPC) that works on the same systems through ports.
- Communication runs by client:
- Opens the subsystem's handle.
- Sends request.
- The server:
- Creates comm ports.
- Returns a handle.
- Comm ports send messages with callbacks.
Communications in Client-Server Systems
- Client-server systems use; sockets, remote procedure calls, pipes, and remote method invocation (Java).
Sockets
- Generally used for Client-Server Systems.
- They are defined as a communication endpoint, and identified by IP address and port to be combined.
161.25.19.8:1625
specifies port1625
on host161.25.19.8
.
Socket Communication
- Involves a server listening on a specified port, and a client requesting a connection and the server connects from the client.
- Well-known services have ports below
1024
; Telnet uses23
, FTP uses21
, and HTTP uses80
. - New processes accessing port 80 should create new ports with values > 1024.
Remote Procedure Calls (RPC)
- Protocol to remotely request a service without network configuration.
- Requires message-based communications between hosts to operate reliably.
- Every message is sent to a port.
- RPCDaemon listens to a port and sends a function.
- A function is code provided by the request on the remote system.
- After the function, any output in a separate message.
Remote Procedure Calls - Stubs
- Stubs hide details for client communications.
- Remote procedures get separate stubs.
- Stubs look for ports or server using 'marshalling' to transmit.
Remote Procedure Calls - Issues
- Data rep can use 32-bit, big-endian, and little-endian solutions using External Data Representation (XDR).
- A network error is fixed when Action (ACK) is done, or messages are endlessly resent.
Pipes
- Pipes: a conduit for communication with potential issues of unidirectionality, bidirectionality (half or full-duplex), and parental relationship.
- Can pipes be used over a network?
Ordinary Pipes
- Ordinary pipes: Communication in standard producer-consumer style.
- Producers use the write-end and consumers use the read-end, making communication unidirectional and requiring a parent-child relation.
Named Pipes
- A named pipe uses increased power from ordinary pipes that's useful for two-way communication, without child/parent, for many processes and Windows/UNIX.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.