There are five phases or states of the process life cycle
When the job is accepted by the system, it is in the start state and placed in the main queue
The process is not yet loaded into main memory, so it isn't an executable process at this point
The process control block (PCB) is created in this state/phase
When the process is ready to run, the Job Scheduler uses some predefined policy to move it from the start state to the ready state
Processes in this state wait for the CPU
This is the state where availability of memory is checked
The jobs that are being processed are now moved from the ready state into the running state by the Process Scheduler using a predefined algorithm
In a single processor system, only one process can be run at a time, which implies that only one process will be in the running state at a time
The process may be moved from the running state back to the ready state due to timeout or some other interrupt occurring
When the process cannot continue further, the Process Scheduler moves the process from the running state to the wait state
This may be because the process needs to wait for some specific resource allocation or completion of some I/O operation
When the requested resources are allocated or the I/O operation is completed, the Process scheduler moves the process from the wait state into the ready state
Finally, the Process Scheduler moves the process from the running state to the terminate state if the process has successfully completed its operation, if the process exceeds its time limit (timer), or some error occurs in the process, causing the OS to terminate the process prematurely Process ID, or PID, which is a unique identifier associated with each process
Process state, to specify the current state of the process
Process privileges, which specify whether or not a process has permission to access system resources
Process priority level, to specify the priority level of some process relative to other processes
Pointer to point to the parent process of the given process
Program counter to point to the address of the next instruction in the program to execute
Context data, which is present in the register in the processor while the process is executing
Memory management information to keep track of the information about the page table, memory limits, and segment table (depending on the memory being used by OS)
I/O status information to indicate a list of I/O devices allocated to the process, outstanding I/O requests, list of files in use by the process, etc.
Accounting information, such as the amount of processor time and other resources used by the process, which is particularly useful for enterprise environments The producer-consumer problem is a scenario in which a producer produces items and puts them in storage while the consumer takes items from the same storage. It is used to explain cooperative processes and data sharing between the two
In the scenario with zero buffer capacity, the producer must wait for the consumer to take each item from the storage before putting a new item in storage.
Zero buffer capacity is most dependent on the consumer since the producer must halt production of items to put in storage. The producer must communicate explicitly with the consumer in this scenario.
In the scenario with bounded buffer capacity, there is a finite number of items that the producer can put in storage before the storage is filled up
Once this happens, the producer must wait for the consumer to take an item from the storage, like in zero buffer capacity. However, unlike zero buffer capacity, the producer in bounded buffer capacity does not need to wait for the consumer to take each item and can instead put multiple items in storage, until the storage is completely filled.
In the scenario with unbounded buffer capacity, there is (seemingly) no limit on the number of items that the producer can put in storage before the storage is filled up
In this scenario, the producer can constantly put items into storage with no restrictions on the number of items that can be stored at a time.
In all three of these scenarios, the consumer will need to wait for the producer if there are no items in storage, just like how the producer may need to wait for the consumer to take items out of storage in bounded and zero buffer capacity scenarios. In IPC, "storage" can refer to either shared memory or message passing, depending on the context.
A quick example is the message queues in Assignment01 had a bounded buffer capacity, set by the kernel, which was 10. Connection-Oriented (TCP):
The server needs to assign an address and port to the socket that the client will be requesting for the connection
After this, the server needs to listen to this port for any incoming requests from the client
At this point, the client sends the request
Once the server receives the request, etc., the client closes and terminates its socket
Connectionless (UDP):
The client does not need to establish a connection with the server and instead sends a datagram to the server
Similarly, the server does not accept the connection from the client and instead just waits until the data arrives from some client by calling recfrom()
Once the client is done, it simply closes the socket while the server waits for another request from any client
Analogy:
Two houses are on opposite sides of a river and one needs to send a message/letter to the other, but there isn't a way to cross the river yet
Two different approaches:
Build a bridge over the river (connection-oriented)
Send a pigeon (connectionless)
Sending a pigeon will be much quicker, but who knows what could happen after you send it. The letter could fall into the water, the pigeon could fly the wrong way, etc. Only one house needs to send the pigeon while the other house will receive it without having to do anything.
Building a bridge will take longer, but once it's built, there will be a guarantee that message/letter makes it to the other house. Both houses (server and client) need to contribute to the building as well. 5th Edition•ISBN: 9780124077263David A. Patterson, John L. Hennessy220 solutions
7th Edition•ISBN: 9780133970777 (2 more)Ramez Elmasri, Shamkant B. Navathe687 solutions
5th Edition•ISBN: 9781118898208Jack T. Marchewka346 solutions
5th Edition•ISBN: 9781118898208Jack T. Marchewka346 solutions