Chapter 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Socket

A ________ is defined as an endpoint for communication. A pair of processes communicating over a network employs a pair of sockets—one for each process. A socket is identified by an IP address concatenated with a port number. In general, sockets use a client-server architecture. The server waits for incoming client requests by listening to a specified port. Once a request is received, the server accepts a connection from the client socket to complete the connection. Servers implementing specific services (such as SSH, FTP, and HTTP) listen to well-known ports (an SSH server listens to port 22; an FTP server listens to port 21; and a web, or HTTP, server listens to port 80). All ports below 1024 are considered well known and are used to implement standard services.

Producer, Consumer

A __________ process produces information that is consumed by a _____________ process. For example, a compiler may produce assembly code that is consumed by an assembler. The assembler, in turn, may produce object modules that are consumed by the loader.

Pipe

A ___________ acts as a conduit allowing two processes to communicate. Pipes were one of the first IPC mechanisms in early UNIX systems. They typically provide one of the simpler ways for processes to communicate with one another, although they also have some limitations. In implementing a pipe, four issues must be considered: 1. Does the pipe allow bidirectional communication, or is communication unidirectional? 2. If two-way communication is allowed, is it half duplex (data can travel only one way at a time) or full duplex (data can travel in both directions at the same time)? 3. Must a relationship (such as parent-child) exist between the communicating processes? 4. Can the pipes communicate over a network, or must the communicating processes reside on the same machine?

Dispatched

A new process is initially put in the ready queue. It waits there until it is selected for execution, or _____________.

Fact about Sockets

Although most program examples in this text use C, we will illustrate sockets using Java, as it provides a much easier interface to sockets and has a rich library for networking utilities. Those interested in socket programming in C or C++ should consult the bibliographical notes at the end of the chapter. Java provides three different types of sockets. Connection-oriented (TCP) sockets are implemented with the Socket class. Connectionless (UDP) sockets use the DatagramSocket class. Finally, the MulticastSocket class is a subclass of the DatagramSocket class. A multicast socket allows data to be sent to multiple recipients. Communication using sockets—although common and efficient—is considered a low-level form of communication between distributed processes. One reason is that sockets allow only an unstructured stream of bytes to be exchanged between the communicating threads. It is the responsibility of the client or server application to impose a structure on the data. In the next subsection, we look a higher-level method of communication: remote procedure calls (RPCs).

Random Important Fact

Although two processes may be associated with the same program, they are nevertheless considered two separate execution sequences. For instance, several users may be running different copies of the mail program, or the same user may invoke many copies of the web browser program. Each of these is a separate process; and although the text sections are equivalent, the data, heap, and stack sections vary. It is also common to have a process that spawns many processes as it runs.

User Programs

Although we personally prefer the more contemporary term process, the term job has historical significance, as much of operating system theory and terminology was developed during a time when the major activity of operating systems was job processing. Therefore, in some appropriate instances we use job when describing the role of the operating system. As an example, it would be misleading to avoid the use of commonly accepted terms that include the word job (such as job scheduling) simply because process has superseded job. Early computers were batch systems that executed jobs, followed by the emergence of time-shared systems that ran __________________, or tasks.

Process State

As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. A process may be in one of the following states: • New. The process is being created. • Running. Instructions are being executed. • Waiting. The process is waiting for some event to occur (such as an I/O completion or reception of a signal). • Ready. The process is waiting to be assigned to a processor • Terminated. The process has finished execution.

Ready Queue

As processes enter the system, they are put into a ________________, where they are ready and waiting to execute on a CPU's core This queue is generally stored as a linked list; a ready-queue header contains pointers to the first PCB in the list, and each PCB includes a pointer field that points to the next PCB in the ready queue.

Interprocess Communication (IPC)

Cooperating processes require an ______________________ mechanism that will allow them to exchange data— that is, send data to and receive data from each other. There are two fundamental models of interprocess communication: shared memory and message passing.

Communication Link

If processes P and Q want to communicate, they must send messages to and receive messages from each other: a _____________________ must exist between them. This link can be implemented in a variety of ways. We are concerned here not with the link's physical implementation (such as shared memory, hardware bus, or network) but rather with its logical implementation. 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

Foreground, Background

On a mobile device, the _____________ application is the application currently open and appearing on the display. The _______________ application remains in memory, but does not occupy the display screen.

Stack Section

One of four sections of the memory layout of a process. Temporary data storage when invoking functions (such as function parameters, return addresses, and local variables).

Text Section

One of four sections of the memory layout of a process. The executable code.

Data Section

One of four sections of the memory layout of a process. The global variables.

Heap Section

One of four sections of the memory layout of a process. The memory that is dynamically allocated during program run time.

Computation Speedup

One of several reasons for providing an environment that allows process cooperation. 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.

Information Sharing

One of several reasons for providing an environment that allows process cooperation. Since several applications may be interested in the same piece of information (for instance, copying and pasting), we must provide an environment to allow concurrent access to such information

Modularity

One of several reasons for providing an environment that allows process cooperation. We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads.

Remote Procedure Call (RPC)

One of the most common forms of remote service is the______________________________ paradigm, which was designed as a way to abstract the procedure-call mechanism for use between systems with network connections. It is similar in many respects to the IPC mechanism described in Section 3.4, and it is usually built on top of such a system. Here, however, because we are dealing with an environment in which the processes are executing on separate systems, we must use a message-based communication scheme to provide remote service. In contrast to IPC messages, the messages exchanged in RPC communication are well structured and are thus no longer just packets of data. Each message is addressed to an RPC daemon listening to a port on the remote system, and each contains an identifier specifying the function to execute and the parameters to pass to that function. The function is then executed as requested, and any output is sent back to the requester in a separate message. A port in this context is simply a number included at the start of a message packet. The RPC scheme is useful in implementing a distributed file system. Such a system can be implemented as a set of RPC daemons and clients.

Shared Memory

One of two fundamental models of interprocess communication. In the ____________ model, a region of memory that is shared by the cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region. ) Shared memory can be faster than message passing, since message-passing systems are typically implemented using system calls and thus require the more time-consuming task of kernel intervention. In shared-memory systems, system calls are required only to establish shared memory regions. Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance from the kernel is required.

Message Passing

One of two fundamental models of interprocess communication. In the _______________ model, communication takes place by means of messages exchanged between the cooperating processes. Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided. Message passing is also easier to implement in a distributed system than shared memory.

Unbounded

One of two types of buffers during shared memory. The _____________ buffer 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.

Bounded

One of two types of buffers during shared memory. The ______________ buffer 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.

Random Fact

A process terminates when it finishes executing its final statement and asks the operating system to delete it by using the exit() system call.

Parent

A process's ________ is the process that created it;

Children

A process's __________ are any processes that it creates. (Its siblings are children with the same parent process.)

Executable File

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 ________________________ ). 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. Two common techniques for loading executable files are double-clicking an icon representing the executable file and entering the name of the executable file on the command line (as in prog.exe or a.out).

Oridinary Pipe

Common type of pipe. Allow two processes to communicate in standard producer- consumer fashion: the producer writes to one end of the pipe (the write end) and the consumer reads from the other end (the read end). As a result, ordinary pipes are unidirectional, allowing only one-way communication. If two-way communication is required, two pipes must be used, with each pipe sending data in a different direction. Ordinary pipes on Windows systems are termed anonymous pipes, and they behave similarly to their UNIX counterparts: they are unidirectional and employ parent-child relationships between the communicating processes.

Named Pipes

Common type of pipe. __________________ provide a much more powerful communication tool. Communication can be bidirectional, and no parent-child relationship is required. Once a named pipe is established, several processes can use it for communication. In fact, in a typical scenario, a named pipe has several writers. Additionally, named pipes continue to exist after communicating processes have finished. Both UNIX and Windows systems support named pipes, although the details of implementation differ greatly. Named pipes on Windows systems provide a richer communication mechanism than their UNIX counterparts. Full-duplex communication is allowed, and the communicating processes may reside on either the same or different machines. Additionally, only byte-oriented data may be transmitted across a UNIX FIFO (Named Pipe), whereas Windows systems allow either byte- or message-oriented data.

Blocking or Nonblocking

Communication between processes takes place through calls to send() and receive() primitives. There are different design options for implementing each primitive. Message passing may be either __________________________— also known as synchronous and asynchronous. • Blocking send. The sending process is blocked until the message is received by the receiving process or by the mailbox. • Nonblocking send. The sending process sends the message and resumes operation. • Blocking receive. The receiver blocks until a message is available. • Nonblocking receive. The receiver retrieves either a valid message or a null.

Orphans

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

Rendezvous

Different combinations of send() and receive() are possible. When both send() and receive() are blocking, we have a ______________ between the sender and the receiver. The solution to the producer-consumer problem becomes trivial when we use blocking send() and receive() statements. The producer merely invokes the blocking send() call and waits until the message is delivered to either the receiver or the mailbox. Likewise, when the consumer invokes receive(), it blocks until a message is available.

Symmetry, Asymmetry

Direct Communication scheme exhibits ___________ in addressing; that is, both the sender process and the receiver process must name the other to communicate. A variant of this scheme employs _____________ in addressing. Here, only the sender names the recipient; the recipient is not required to name the sender. In this scheme, the send() and receive() primitives are defined as follows: • send(P, message)—Send a message to process P. • receive(id, message)—Receive a message from any process. The variable id is set to the name of the process with which communication has taken place.

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 (PCB)

Each process is represented in the operating system by a _________________________ —also called a task control block. It contains many pieces of information associated with a specific process, including these: • Process state. The state may be new, ready, running, waiting, halted, and so on. • Program counter. The counter indicates the address of the next instruction to be executed for this process. • CPU registers. The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition-code information. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward when it is rescheduled to run. • CPU-scheduling information. This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters. • 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. • 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 status information. This information includes the list of I/O devices allocated to the process, a list of open files, and so on. In brief, the PCB simply serves as the repository for all the data needed to start, or restart, a process, along with some accounting data.

Activation Record

Each time a function is called, an _______________________ containing function parameters, local variables, and the return address is pushed onto the stack; when control is returned from the function, the activation record is popped from the stack. Similarly, the heap will grow as memory is dynamically allocated, and will shrink when memory is returned to the system. Although the stack and heap sections grow toward one another, the operating system must ensure they do not overlap one another.

I/O, CPU

In general, most processes can be described as either ____ bound or ____ bound. An I/O-bound process is one that spends more of its time doing I/O than it spends doing computations. A CPU-bound process, in contrast, generates I/O requests infrequently, using more of its time doing computations.

Random Important Fact

It is important to realize that only one process can be running on any processor core at any instant. Many processes may be ready and waiting, however.

On page 113.

Look at Figure 3.5

Random Fact

Messages sent by a process can be either fixed or variable in size. If only fixed-sized messages can be sent, the system-level implementation is straightforward. This restriction, however, makes the task of programming more difficult. Conversely, variable-sized messages require a more complex system-level implementation, but the programming task becomes simpler. This is a common kind of tradeoff seen throughout operating-system design.

Process Identifier (PID)

Most operating systems (including UNIX, Linux, and Windows) identify processes according to a unique _________________, which is typically an integer number. The ___________ provides a unique value for each process in the system, and it can be used as an index to access various attributes of a process within the kernel.

External Data Representation (XDR)

Parameter marshaling addresses the issue concerning 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. One such representation is known as ________________________. On the client side, parameter marshaling involves converting the machine-dependent data into XDR before they are sent to the server. On the server side, the XDR data are unmarshaled and converted to the machine-dependent representation for the server.

Independent, Cooperating

Processes executing concurrently in the operating system may be either __________________ processes or _____________________processes. A process is independent if it does not share data with any other processes executing in the system. A process is cooperating 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 cooperating process.

Wait Queue

Processes that are waiting for a certain event to occur — such as completion of I/O — are placed in a ______________.

Process

Program in execution

Importance Heirarchy

Rather than terminating an arbitrary process, Android has identified an _____________________________ of processes, and when the system must terminate a process to make resources available for a new, or more important, process, it terminates processes in order of increasing importance. From most to least important, the hierarchy of process classifications is as follows: • Foreground process—The current process visible on the screen, representing the application the user is currently interacting with • Visible process—A process that is not directly visible on the foreground but that is performing an activity that the foreground process is referring to (that is, a process performing an activity whose status is displayed on the foreground process) • Service process—A process that is similar to a background process but is performing an activity that is apparent to the user (such as streaming music) • Background process—A process that may be performing an activity but is not apparent to the user. • Empty process—A process that holds no active components associated with any application. If system resources must be reclaimed, Android will first terminate empty processes, followed by background processes, and so forth. Processes are assigned an importance ranking, and Android attempts to assign a process as high a ranking as possible. For example, if a process is providing a service and is also visible, it will be assigned the more-important visible classification.

Service

Since its origins, Android has supported multitasking and does not place constraints on the types of applications that can run in the background. If an application requires processing while in the background, the application must use a ___________, a separate application component that runs on behalf of the background process.

Swapping

Some operating systems have an intermediate form of scheduling, known as __________, whose key idea 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. Typically only necessary when memory has been overcommitted and must be freed up.

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.

Context Switch

Switching the CPU core 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 a context switch 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. Context switch time is pure overhead, because the system does no useful work while switching.

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.

Degree of Multiprogramming

The number of processes currently in memory.

Process Scheduler

The objective of multiprogramming is to have some process running at all times so as to maximize CPU utilization. The objective of time sharing is to switch a CPU core among processes so frequently that users can interact with each program while it is running. To meet these objectives, the __________________ selects an available process (possibly from a set of several available processes) for program execution on a core.

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. Thus, the user cannot simultaneously type in characters and run the spell checker. 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. On systems that support threads, the PCB is expanded to include information for each thread.

CPU Scheduler

The role of the __________________ is to select from among the processes that are in the ready queue and allocate a CPU core to one of them. An I/O-bound process may execute for only a few milliseconds before waiting for an I/O request. Although a CPU-bound process will require a CPU core for longer durations, the scheduler is unlikely to grant the core to a process for an extended period. Instead, it is likely designed to forcibly remove the CPU from a process and schedule another process to run. Therefore, the CPU scheduler executes at least once every 100 milliseconds, although typically much more frequently.

Stub

The semantics of RPCs allows a client to invoke a procedure on a remote host as it would invoke a procedure locally. The RPC system hides the details that allow communication to take place by providing a ________ on the client side. This stub locates the port on the server and marshals the parameters.

Program Counter

The status of the current activity of a process is represented by the value of the __________________ and the contents of the processor's registers. This is a CPU register indicating the main memory location of the next instruction to load and execute.

Direct Communication

Under ________________________, 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. A communication link in this scheme has the following properties: • A link is established automatically between every pair of processes that want to communicate. The processes need to know only each other's identity to communicate. • A link is associated with exactly two processes. • Between each pair of processes, there exists exactly one link.

Random Fact

When a process creates a new process, two possibilities for execution exist: 1. The parent continues to execute concurrently with its children. 2. The parent waits until some or all of its children have terminated. There are also two address-space possibilities for the new process: 1. The child process is a duplicate of the parent process (it has the same program and data as the parent). 2. The child process has a new program loaded into it.

Zombie

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 _______ process.

Context

When an interrupt occurs, the system needs to save the current _______ of the process running on the CPU core so that it can restore that ____________ when its processing is done, essentially suspending the process and then resuming it. The ____________ is represented in the PCB of the process. It includes the value of the CPU registers, the process state, and memory-management information. Generically, we perform a state save of the current state of the CPU core, be it in kernel or user mode, and then a state restore to resume operations.

Zero Capacity, Bounded Capacity, Unbounded Capacity

Whether communication is direct or indirect, messages exchanged by communicating processes reside in a temporary queue. Basically, such queues can be implemented in three ways: • ___________________. The queue has a maximum length of zero; thus, the link cannot have any messages waiting in it. In this case, the sender must block until the recipient receives the message. • ______________________. The queue has finite length n; thus, at most n messages can reside in it. If the queue is not full when a new message is sent, the message is placed in the queue (either the message is copied or a pointer to the message is kept), and the sender can continue execution without waiting. The link's capacity is finite, however. If the link is full, the sender must block until space is available in the queue. • ________________________. The queue's length is potentially infinite; thus, any number of messages can wait in it. The sender never blocks. The zero-capacity case is sometimes referred to as a message system with no buffering. The other cases are referred to as systems with automatic buffering.

Indirect Communication

With _________________________, the messages are sent to and received from mailboxes, or ports. A mailbox can be viewed abstractly as an object into which messages can be placed by processes and from which messages can be removed. Each mailbox has a unique identification. For example, POSIX message queues use an integer value to identify a mailbox. A process can communicate with another process via a number of different mailboxes, but two processes can communicate only if they have a shared mailbox. The send() and receive() primitives are defined as follows: • send(A, message)—Send a message to mailbox A. • receive(A, message)—Receive a message from mailbox A. In this scheme, a communication link has the following properties: • A link is established between a pair of processes only if both members of the pair have a shared mailbox. • A link may be associated with more than two processes. • Between each pair of communicating processes, a number of different links may exist, with each link corresponding to one mailbox


Set pelajaran terkait

THE NERVOUS SYSTEM- ATI TEAS NOTES

View Set

Chapter 11: Maternal Adaptation During Pregnancy (Prep U)

View Set

random practice APUSH questions (AP test review)

View Set

HLTH 231 Exam 2 (Ch. 8-12, & 16)

View Set

Ch.14 - Intellectual Property Rights

View Set

Holes Anatomy and Physiology final

View Set

Macroeconomics-Chapter 9-Long Run Economic Growth

View Set

Med-Surg: Adaptive Quizzing: Chapter 11

View Set