Processes Ch. 3

Ace your homework & exams now with Quizwiz!

context

1, interrupts cause the operating system to change a CPU from its current task and to run a kernel routine. Such operations happen frequently on general-purpose systems. When an interrupt occurs, the system needs to save the current context of the process running on the CPU so that it can restore that context when its processing is done, essentially suspending the process and then resuming it.

process

A __________ is a program in execution.

dispatched

A new process is initially put in the ready queue. It waits there until it is selected for execution, or ____________. Once the process is allocated the CPU and is executing, one of several events could occur: • The process could issue an I/O request and then be placed in an I/O queue. • The process could create a new child process and wait for the child's termination. • The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue.

port

A port is simply a number included at the start of a message packet.

process state program counter cpu registers cpu-scheduling information memory-management information accounting information i/o status information

A process control block has many pieces of information associated with a specific process, including these: 1. 2. 3. 4. 5. 6. 7.

socket

A socket is defined as an endpoint for communication. A pair of processes communicating over a network employs a pair of these—one for each process. It is identified by an IP address concatenated with a port number.

operating system user processes

A system consists of a collection of processes: _________ processes executing system code and _________ executing user code.

pipes

Acts as a conduit allowing two processes to communicate Issues: Is communication unidirectional or bidirectional? In the case of two-way communication, is it half or full-duplex? Must there exist a relationship (i.e., parent-child) between the communicating processes? Can the pipes be used over a network?

i/o bound process cpu-bound process

An _____ is one that spends more of its time doing I/O than it spends doing computations. _____, in contrast, generates I/O requests infrequently, using more of its time doing computations.

state

As a process executes, it changes ___1___. The ____1____of a process is defined in part by the current activity of that process

job queue ready queue

As processes enter the system, they are put into a _________, which consists of all processes in the system. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called the ________. This queue is generally stored as a linked list.

inter-process communication shared memory message passing

Cooperating processes require an____________________ mechanism that will allow them to exchange data and information. There are two fundamental models: _________ and ___________. In the first model mentioned, a region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region. In the second model mentioned, communication takes place by means of messages exchanged between the cooperating processes.

state save state restore

Generically, we perform a _______ of the current state of the CPU, be it in kernel or user mode, and then a _______ to resume operations

orphans

Now consider what would happen if a parent did not invoke wait() and instead terminated, thereby leaving its child processes as _______.

long-term scheduler job scheduler

Often, in a batch system, more processes are submitted than can be executed immediately. These processes are spooled to a mass-storage device (typically a disk), where they are kept for later execution. The __________, or _________, selects processes from this pool and loads them into memory for execution.

big-endian little-endian

One issue that must be dealt with concerns differences in data representation on the client and server machines. Consider the representation of 32-bit integers. Some systems (known as big-endian) store the most significant byte first, while other systems (known as little-endian) store the least significant byte first. Neither order is "better" per se; rather, the choice is arbitrary within a computer architecture. To resolve differences like this, many RPC systems define a machine-independent representation of data

context switch

Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. This task is known as a ________. When it occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run. It's time is pure overhead, because the system does no useful work while switching

port mailbox

d. A mailbox set is a collection of mailboxes, as declared by the task, which can be grouped together and treated as one mailbox for the purposes of the task. Threads in a task can receive only from a mailbox or mailbox set for which the task has receive access. A port status() system call returns the number of messages in a given mailbox. The receive operation attempts to receive from (1) any mailbox in a mailbox set or (2) a specific (named) mailbox. If no message is waiting to be received, the receiving thread can either wait at most n milliseconds or not wait at all

program counter stack data section heap

A process includes the current activity, as represented by the value of the __________ and the contents of the processor's registers. A process generally also includes the process _________, which contains temporary data (such as function parameters, return addresses, and local variables), and a ____________, which contains global variables. A process may also include a _________, which is memory that is dynamically allocated during process run time. We emphasize that a program by itself is not a process. A program is a passive entity, such as a file containing a list of instructions stored on disk (often called an executable file). In contrast, a process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources. A program becomes a process when an executable file is loaded into memory

independent process cooperating process

A process is either _______ if it cannot affect or be affected by the other processes executing in the system, or ____2____ if it can affect or be affected by the other processes executing in the system. Clearly, any process that shares data with other processes is a ____2____

text section

A process is more than the program code, which is sometimes known as the _________.

new running waiting ready terminated

A process may be in one of the following states: 1. 2. 3. 4. 5.

scheduler

A process migrates among the various scheduling queues throughout its lifetime. The operating system must select, for scheduling purposes, processes from these queues in some fashion. The selection process is carried out by the appropriate _________.

batch programs tasks

A question that arises in discussing operating systems involves what to call all the CPU activities. A ________ system executes jobs, whereas a time-shared system has user _________, or _________.

tree

During the course of execution, a process may create several new processes. As mentioned earlier, the creating process is called a parent process, and the new processes are called the children of that process. Each of these new processes may in turn create other processes, forming a _____ of processes.

process control block task control block

Each process is represented in the operating system by a ____________, also called a task ________.

communication link

Message-Passing Systems This scheme requires that these processes share a region of memory and that the code for accessing and manipulating the shared memory be written explicitly by the application programmer. Another way to achieve the same effect is for the operating system to provide the means for cooperating processes to communicate with each other via a message-passing facility. Message passing provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space. It is particularly useful in a distributed environment, where the communicating processes may reside on different computers connected by a network. For example, an Internet chat program could be designed so that chat participants communicate with one another by exchanging messages If processes P and Q want to communicate, they must send messages to and receive messages from each other: a ____________ must exist between them. Here are several methods for logically implementing a link and the send()/receive() operations: • Direct or indirect communication • Synchronous or asynchronous communication • Automatic or explicit buffering

mach operating system

Most communication in the _______ including all intertask information—is carried out by messages

direct communication

Processes that want to communicate must have a way to refer to each other. They can use either direct or indirect communication. Under direct communication, each process that wants to communicate must explicitly name the recipient or sender of the communication. In this scheme, the send() and receive() primitives are defined as: • send(P, message)—Send a message to process P. • receive(Q, message)—Receive a message from process Q.

producer consumer

Shared-Memory Systems Inter-process communication using shared memory requires communicating processes to establish a region of shared memory. Typically, a shared-memory region resides in the address space of the process creating the shared-memory segment. Other processes that wish to communicate using this shared-memory segment must attach it to their address space. Recall that, normally, the operating system tries to prevent one process from accessing another process's memory. Shared memory requires that two or more processes agree to remove this restriction. They can then exchange information by reading and writing data in the shared areas. The form of the data and the location are determined by these processes and are not under the operating system's control. The processes are also responsible for ensuring that they are not writing to the same location simultaneously. To illustrate the concept of cooperating processes, let's consider the producer-consumer problem, which is a common paradigm for cooperating processes. A _________ process produces information that is consumed by a ________ process.

unbounded buffer bounded buffer

Shared-Memory Systems Two types of buffers can be used. The ___________ places no practical limit on the size of the buffer. The consumer may have to wait for new items, but the producer can always produce new items. The ________ assumes a fixed buffer size. In this case, the consumer must wait if the buffer is empty, and the producer must wait if the buffer is full.

cascading termination

Some systems do not allow a child to exist if its parent has terminated. In such systems, if a process terminates (either normally or abnormally), then all its children must also be terminated. This phenomenon, referred to as ________, is normally initiated by the operating system.

loopback

The IP address 127.0.0.1 is a special IP address known as the ________. When a computer refers to IP address 127.0.0.1, it is referring to itself. This mechanism allows a client and server on the same host to communicate using the TCP/IP protocol. The IP address 127.0.0.1 could be replaced with the IP address of another host running the date server.

medium-term scheduler swapping

The key idea behind a _______ is that sometimes it can be advantageous to remove a process from memory (and from active contention for the CPU) and thus reduce the degree of multiprogramming. Later, the process can be reintroduced into memory, and its execution can be continued where it left off. This scheme is called _______. The process is swapped out, and is later swapped in, by the scheduler. Swapping may be necessary to improve the process mix or because a change in memory requirements has over-committed available memory, requiring memory to be freed up.

degree of multiprogramming

The long-term scheduler executes much less frequently; minutes may separate the creation of one new process and the next. The long-term scheduler controls the ____1____ (the number of processes in memory). If the ____1____ is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. Thus, the long-term scheduler may need to be invoked only when a process leaves the system

multiprogramming time sharing process scheduler

The objective of ________ is to have some process running at all times, to maximize CPU utilization. The objective of ________ is to switch the CPU among processes so frequently that users can interact with each program while it is running To meet these objectives, the process scheduler selects an available process (possibly from a set of several available processes) for program execution on the CPU. For a single-processor system, there will never be more than one running process. If there are more processes, the rest will have to wait until the CPU is free and can be rescheduled.

thread

The process model discussed so far has implied that a process is a program that performs a single _______ of execution. For example, when a process is running a word-processor program, a single thread of instructions is being executed. This single thread of control allows the process to perform only one task at a time. The user cannot simultaneously type in characters and run the spell checker within the same process, for example. Most modern operating systems have extended the process concept to allow a process to have multiple threads of execution and thus to perform more than one task at a time. This feature is especially beneficial on multicore systems, where multiple threads can run in parallel.

device queue

The system also includes other queues. When a process is allocated the CPU, it executes for a while and eventually quits, is interrupted, or waits for the occurrence of a particular event, such as the completion of an I/O request. Suppose the process makes an I/O request to a shared device, such as a disk. Since there are many processes in the system, the disk may be busy with the I/O request of some other process. The process therefore may have to wait for the disk. The list of processes waiting for a particular I/O device is called a _____________. Each device has its own device queue.

cpu-scheduling information

This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters.

accounting information

This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.

i/o process information

This information includes the list of I/O devices allocated to the process, a list of open files, and so on.

memory-management information

This information may include such items as the value of the base and limit registers and the page tables, or the segment tables, depending on the memory system used by the operating system.

matchmaker

Typically, an operating system provides a rendezvous (also called a matchmaker) daemon on a fixed RPC port

communications in client-server systems

What are? Sockets Remote Procedure Calls Pipes Remote Method Invocation (Java)

zombie process

When a process terminates, its resources are deallocated by the operating system. However, its entry in the process table must remain there until the parent calls wait(), because the process table contains the process's exit status. A process that has terminated, but whose parent has not yet called wait(), is known as a _____1____. All processes transition to this state when they terminate, but generally they exist as ___1____ only briefly. Once the parent calls wait(), the process identifier of the ___1___ and its entry in the process table are released.

marshals

When the client invokes a remote procedure, the RPC system calls the appropriate stub, passing it the parameters provided to the remote procedure. This stub locates the port on the server and marshals the parameters. Parameter marshalling involves packaging the parameters into a form that can be transmitted over a network. The stub then transmits a message to the server using message passing. A similar stub on the server side receives this message and invokes the procedure on the server

indirect communication

With ________, the messages are sent to and received from mailboxes, or ports. • send(A, message)—Send a message to mailbox A. • receive(A, message)—Receive a message from mailbox A A mailbox that is owned by the operating system has an existence of its own. It is independent and is not attached to any particular process. The operating system then must provide a mechanism that allows a process to do the following: • Create a new mailbox. • Send and receive messages through the mailbox. • Delete a mailbox.

short-term scheduler cpu scheduler

______1_____, or ___________, selects from among the processes that are ready to execute and allocates the CPU to one of them. The primary distinction between these two schedulers lies in frequency of execution. The ____1____ must select a new process for the CPU frequently. A process may execute for only a few milliseconds before waiting for an I/O request.

process identifier

_______ can be used as an index to access various attributes of a process within the kernel.

ordinary pipes

________ cannot be accessed from outside the process that created it. Typically, a parent process creates a pipe and uses it to communicate with a child process that it created.

blocking send nonblocking send blocking receive nonblocking recieve

_________ - The sending process is blocked until the message is received by the receiving process or by the mailbox. ________ - The sending process sends the message and resumes operation. _________ -The receiver blocks until a message is available. _________ - The receiver retrieves either a valid message or a null.

named pipes

_________ can be accessed without a parent-child relationship.

program counter

___________ - indicates the address of the next instruction to be executed for this process.

reasons for providing an environment that allows process cooperation

• Information sharing. Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information. • Computation speedup. If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing cores. • Modularity. We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads. • Convenience. Even an individual user may work on many tasks at the same time. For instance, a user may be editing, listening to music, and compiling in parallel.

reasons to terminate children of parent process

• The child has exceeded its usage of some of the resources that it has been allocated. (To determine whether this has occurred, the parent must have a mechanism to inspect the state of its children.) • The task assigned to the child is no longer required. • The parent is exiting, and the operating system does not allow a child to continue if its parent terminates.


Related study sets

MS2 Respiratory / Hematology Review Questions

View Set

Pharmocology Section #1 (Lexi + Emily+ Delaney)*

View Set

Second Year 2nd semester mid-term

View Set

PF: 1.3.1 Lesson: Services provided from taxes

View Set

Network troubleshooting (net+ 007 )

View Set

unit 2 The CE SHOP real estate exams

View Set