Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Describe two general approaches to load balancing.

Ans: With push migration, a specific task periodically checks the load on each processor and — if it finds an imbalance—evenly distributes the load by moving processes from overloaded to idle or less-busy processors. Pull migration occurs when an idle processor pulls a waiting task from a busy processor. Push and pull migration are often implemented in parallel on load-balancing systems.

1) An instruction that executes atomically ____. A) must consist of only one machine instruction B) executes as a single, uninterruptible unit C) cannot be used to solve the critical section problem D) All of the above

B

1) ____ is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

D

1. A _____ is an example of a systems program. A) command interpreter B) Web browser C) text formatter D) database system

A

14. The close() system call in UNIX is used to close a file. What is the equivalent system call in Windows: A) CloseHandle() B) close() C) CloseFile() D) Exit()

A

Describe the difference between the fork() and clone() Linux system calls.

Ans: The fork() system call is used to duplicate a process. The clone() system call behaves similarly except that, instead of creating a copy of the process, it creates a separate process that shares the address space of the calling process.

1. The ____ of a process contains temporary data such as function parameters, return addresses, and local variables. A) text section B) data section C) program D) stack

D

10. _____ is not one of the major categories of system calls. A) Process control B) Communications C) Protection D) Security

D

14. The _____ model maps many user-level threads to one kernel thread. A) many-to-many B) two-level C) one-to-one D) many-to-one

D

Difference between hard real-time systems vs soft real-time systems. Provide an application example for both.

Hard real-time: If system encounters a failure it can be catastrophic. Ex: Patients pacemaker Soft real-time: if system encounters a failure it will diminish its performance but will not be catastrophic. Ex: PC games b/c losing pixels will not be super detrimental

Computer systems can be divided into four approximate components. What are they?

Hardware, operating system, application programs, and users.

13. Which of the following statements is true? A) Shared memory is typically faster than message passing. B) Message passing is typically faster than shared memory. C) Message passing is most useful for exchanging large amounts of data. D) Shared memory is far more common in operating systems than message passing.

A

1. Explain why an operating system can be viewed as a resource allocator.

Ans: A computer system has many resources that may be required to solve a problem: CPU time, memory space, file-storage space, I/O devices, and so on. The operating system acts as the manager of these resources. Facing numerous and possibly conflicting requests for resources, the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly.

What are two faster alternatives to implementing the JVM in software on top of a host operating system?

Ans: A faster software technique is to use a just-in-time (JIT) compiler. The first time a Java method is invoked, the bytecodes for the method are turned into native machine language for the host system, and then cached for subsequent invocations. A potentially faster technique is to run the JVM in hardware on a special Java chip that executes the Java bytecode operations as native code.

What role do device controllers and device drivers play in a computer system?

Ans: A general-purpose computer system consists of CPUs and multiple device controllers that are connected through a common bus. Each device controller is in charge of a specific type of device. The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. Typically, operating systems have a device driver for each device controller. This device driver understands the device controller and presents a uniform interface for the device to the rest of the operating system.

What is a loopback and when is it used?

Ans: A loopback is a special IP address: 127.0.0.1. When a computer refers to IP address 127.0.0.1, it is referring to itself. When using sockets for client/server communication, this mechanism allows a client and server on the same host to communicate using the TCP/IP protocol.

What is a thread pool and why is it used?

Ans: A thread pool is a collection of threads, created at process startup, that sit and wait for work to be allocated to them. This allows one to place a bound on the number of concurrent threads associated with a process and reduce the overhead of creating new threads and destroying them at termination.

In what ways does the JVM protect and manage memory?

Ans: After a class is loaded, the verifier checks that the .class file is valid Java bytecode and does not overflow or underflow the stack. It also ensures that the bytecode does not perform pointer arithmetic, which could provide illegal memory access. The JVM also automatically manages memory by performing garbage collection — the practice of reclaiming memory from objects no longer in use and returning it to the system.

What effect does the size of the time quantum have on the performance of an RR algorithm?

Ans: At one extreme, if the time quantum is extremely large, the RR policy is the same as the FCFS policy. If the time quantum is extremely small, the RR approach is called processor sharing and creates the appearance that each of n processes has its own processor running at 1/n the speed of the real processor.

Explain the terms "at most once" and "exactly once" and indicate how they relate to remote procedure calls.

Ans: Because a remote procedure call can fail in any number of ways, it is important to be able to handle such errors in the messaging system. The term "at most once" refers to ensuring that the server processes a particular message sent by the client only once and not multiple times. This is implemented by merely checking the timestamp of the message. The term "exactly once" refers to making sure that the message is executed on the server once and only once so that there

In Java, what two things does calling the start() method for a new Thread object accomplish?

Ans: Calling the start() method for a new Thread object first allocates memory and initializes a new thread in the JVM. Next, it calls the run() method, making the thread eligible to be run by the JVM. Note that the run() method is never called directly. Rather, the start() method is called, which then calls the run() method.

Why are clustered systems considered to provide high-availability service?

Ans: Clustered systems are considered high-availability in that these types of systems have redundancies capable of taking over a specific process or task in the case of a failure. The redundancies are inherent due to the fact that clustered systems

Name the three types of sockets used in Java and the classes that implement them.

Ans: 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.

Describe why direct memory access (DMA) is considered an efficient mechanism for performing I/O.

Ans: DMA is efficient for moving large amounts of data between I/O devices and main memory. It is considered efficient because it removes the CPU from being responsible for transferring data. DMA instructs the device controller to move data between the devices and main memory.

Explain the purpose of external data representation (XDR).

Ans: Data can be represented differently on different machine architectures (e.g., little-endian vs. big-endian). XDR represents data independently of machine architecture. XDR is used when transmitting data between different machines using an RPC.

What is deterministic modeling and when is it useful in evaluating an algorithm?

Ans: Deterministic modeling takes a particular predetermined workload and defines the performance of each algorithm for that workload. Deterministic modeling is simple, fast, and gives exact numbers for comparison of algorithms. However, it requires exact numbers for input, and its answers apply only in those cases. The main uses of deterministic modeling are describing scheduling algorithms and providing examples to indicate trends.

Explain the fundamental differences between the UNIX fork() and Windows CreateProcess() functions.

Ans: Each function is used to create a child process. However, fork() has no parameters; CreateProcess() has ten. Furthermore, whereas the child process created with fork() inherits a copy of the address space of its parent, the CreateProcess() function requires specifying the address space of the child process.

Describe two approaches to provide direct sharing of resources in a virtual-machine concept.

Ans: First, it is possible to share a minidisk, and thus to share files. This scheme is modeled after a physical shared disk, but is implemented by software. Second, it is possible to define a network of virtual machines, each of which can send information over the virtual communications network. Again, the network is modeled after physical communication networks, but is implemented in software.

Describe two approaches to the binding of client and server ports during RPC calls.

Ans: First, the binding information may be predetermined, in the form of fixed port addresses. At compile time, an RPC call has a fixed port number associated with it. Second, binding can be done dynamically by a rendezvous mechanism. Typically, an operating system provides a rendezvous daemon on a fixed RPC port. A client then sends a message containing the name of the RPC to the rendezvous daemon requesting the port address of the RPC it needs to execute. The port number is returned, and the RPC calls can be sent to that port until the process terminates (or the server crashes).

Why should a web server not run as a single-threaded process?

Ans: For a web server that runs as a single-threaded process, only one client can be serviced at a time. This could result in potentially enormous wait times for a busy server.

Describe how trace tapes are used in distribution-driven simulations.

Ans: In a distribution-driven simulation, the frequency distribution indicates only how many instances of each event occur; it does not indicate anything about the order of their occurrence. Trace tapes can correct this problem. A trace tape is created to monitor the real system and record the sequence of actual events. This sequence then drives the simulation. Trace tapes provide an excellent way to compare two algorithms on exactly the same set of real inputs.

Explain the fundamental difference between asymmetric and symmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems?

Ans: In asymmetric multiprocessing, all scheduling decisions, I/O, and other system activities are handled by a single processor, whereas in SMP, each processor is self-scheduling.Multiprocessors can save money by not duplicating power supplies, housings, and peripherals. They can execute programs more quickly and can have increased reliability. They are also more complex in both hardware and software than uniprocessor systems.

How can deferred cancellation ensure that thread termination occurs in an orderly manner as compared to asynchronous cancellation?

Ans: In asynchronous cancellation, the thread is immediately cancelled in response to a cancellation request. There is no insurance that it did not quit in the middle of a data update or other potentially dangerous situation. In deferred cancellation, the thread polls whether or not it should terminate. This way, the thread can be made to cancel at a convenient time.

Explain cache coherency.

Ans: In multiprocessor environments, two copies of the same data may reside in the local cache of each CPU. Whenever one CPU alters the data, the cache of the other CPU must receive an updated version of this data. Cache coherency involves ensuring that multiple caches store the most updated version of the stored data.

Describe the operating system's two modes of operation.

Ans: In order to ensure the proper execution of the operating system, most computer systems provide hardware support to distinguish between user mode and kernel mode. A mode bit is added to the hardware of the computer to indicate the current mode: kernel (0) or user (1). When the computer system is executing on behalf of a user application, the system is in user mode. However, when a user application requests a service from the operating system (via a system call), it must transition from user to kernel mode to fulfill the request.

Why is main memory not suitable for permanent program storage or backup purposes? Furthermore, what is the main disadvantage to storing information on a magnetic disk drive as opposed to main memory?

Ans: Main memory is a volatile memory in that any power loss to the system will result in erasure of the data stored within that memory. While disk drives can store more information permanently than main memory, disk drives are significantly slower.

Explain the term marshalling.

Ans: Marshalling involves the packaging of parameters into a form that can be transmitted over the network. 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. If necessary, return values are passed back to the client using the same technique.

Multicore systems present certain challenges for multithreaded programming. Briefly describe these challenges.

Ans: Multicore systems have placed more pressure on system programmers as well as application developers to make efficient use of the multiple computing cores. These challenges include determining how to divide applications into separate tasks that can run in parallel on the different cores. These tasks must be balanced such that each task is doing an equal amount of work. Just as tasks must be separated, data must also be divided so that it can be accessed by the tasks running on separate cores. So that data can safely be accessed, data dependencies must be identified and where such dependencies exist, data accesses must be synchronized to ensure the safety of the data. Once all such challenges have been met, there remains considerable challenges testing and debugging such applications.

Distinguish between uniform memory access (UMA) and non-uniform memory access (NUMA) systems.

Ans: On UMA systems, accessing RAM takes the same amount of time from any CPU. On NUMA systems, accessing some parts of memory may take longer than accessing other parts of memory, thus creating a performance penalty for certain memory accesses.

Describe two techniques for creating Thread objects in Java.

Ans: One approach is to create a new class that is derived from the Thread class and to override its run() method. An alternative — and more commonly used — technique is to define a class that implements the Runnable interface. When a class implements Runnable, it must define a run() method. The code implementing the run() method is what runs as a separate thread.

What are the advantages and disadvantages of using a microkernel approach?

Ans: One benefit of the microkernel approach is ease of extending the operating system. All new services are added to user space and consequently do not require modification of the kernel. The microkernel also provides more security and reliability, since most services are running as user — rather than kernel — processes. Unfortunately, microkernels can suffer from performance decreases due to increased system function overhead.

Some UNIX systems have two versions of fork(). Describe the function of each version, as well as how to decide which version to use.

Ans: One version of fork() duplicates all threads and the other duplicates only the thread that invoked the fork() system call. Which of the two versions of fork() to use depends on the application. If exec() is called immediately after forking, then duplicating all threads is unnecessary, as the program specified in the parameters to exec() will replace the process. If, however, the separate process does not call exec() after forking, the separate process should duplicate all threads.

Describe the differences between physical, virtual, and logical memory.

Ans: Physical memory is the memory available for machines to execute operations (i.e., cache, random access memory, etc.). Virtual memory is a method through which programs can be executed that requires space larger than that available in physical memory by using disk memory as a backing store for main memory. Logical memory is an abstraction of the computer's different types of memory that allows programmers and applications a simplified view of memory and frees them from concern over memory-storage limitations.

Describe some requirements, or goals, when designing an operating system.

Ans: Requirements can be divided into user and system goals. Users desire a system that is convenient to use, easy to learn, and to use, reliable, safe, and fast. System goals are defined by those people who must design, create, maintain, and operate the system: The system should be easy to design, implement, and maintain; it should be flexible, reliable, error-free, and efficient.

Describe Solaris 10 containers.

Ans: Solaris containers — or zones — provides a virtual layer between the operating system and its applications. Only one kernel is present and the hardware is not virtualized. However, the operating system and its devices are virtualized, providing processes within a container that they are the only running application on the system.

Explain the process of starvation and how aging can be used to prevent it.

Ans: Starvation occurs when a process is ready to run but is stuck waiting indefinitely for the CPU. This can be caused, for example, when higher-priority processes prevent low-priority processes from ever getting the CPU. Aging involves gradually increasing the priority of a process so that a process will eventually achieve a high enough priority to execute if it waited for a long enough period of time.

Distinguish between system and application programs.

Ans: System programs are not part of the kernel, but still are associated with the operating system. Application programs are not associated with the operating of the system.

List the four major categories of the benefits of multithreaded programming. Briefly explain each.

Ans: The benefits of multithreaded programming fall into the categories: responsiveness, resource sharing, economy, and utilization of multiprocessor architectures. Responsiveness means that a multithreaded program can allow a program to run even if part of it is blocked. Resource sharing occurs when an application has several different threads of activity within the same address space. Threads share the resources of the process to which they belong. As a result, it is more economical to create new threads than new processes. Finally, a single-threaded process can only execute on one processor regardless of the number of processors actually present. Multiple threads can run on multiple processors, thereby increasing efficiency.

What are the advantages of using a higher-level language to implement an operating system?

Ans: The code can be written faster, is more compact, and is easier to understand and debug. In addition, improvements in compiler technology will improve the generated code for the entire operating system by simple recompilation. Finally, an operating system is far easier to port — to move to some other hardware — if it is written in a higher-level language.

Describe the compute-server and file-server types of server systems.

Ans: The compute-server system provides an interface to which a client can send a request to perform an action (for example, read data from a database); in response, the server executes the action and sends back results to the client. The file-server system provides a file-system interface where clients can create, update, read, and delete files. An example of such a system is a Web server that delivers files to clients running Web browsers.

Explain the difference between an I/O-bound process and a CPU-bound process.

Ans: The differences between the two types of processes stem from the number of I/O requests that the process generates. An I/O-bound process spends more of its time seeking I/O operations than doing computational work. The CPU-bound process infrequently requests I/O operations and spends more of its time performing computational work.

What role does the dispatcher play in CPU scheduling?

Ans: The dispatcher gives control of the CPU to the process selected by the short-term scheduler. To perform this task, a context switch, a switch to user mode, and a jump to the proper location in the user program are all required. The dispatch should be made as fast as possible. The time lost to the dispatcher is termed dispatch latency.

What are the two different ways in which a thread library could be implemented?

Ans: The first technique of implementing the library involves ensuring that all code and data structures for the library reside in user space with no kernel support. The other approach is to implement a kernel-level library supported directly by the operating system so that the code and data structures exist in kernel space.

Explain the purpose of an interrupt vector.

Ans: The interrupt vector is merely a table of pointers to specific interrupt-handling routines. Because there are a fixed number of interrupts, this table allows for more efficient handling of the interrupts than with a general-purpose, interrupt-processing routine.

Explain the concept of a CPU-I/O burst cycle.

Ans: The lifecycle of a process can be considered to consist of a number of bursts belonging to two different states. All processes consist of CPU cycles and I/O operations. Therefore, a process can be modeled as switching between bursts of CPU execution and I/O wait.

Explain the main differences between a short-term and long-term scheduler.

Ans: The primary distinction between the two schedulers lies in the frequency of execution. The short-term scheduler is designed to frequently select a new process for the CPU, at least once every 100 milliseconds. Because of the short time between executions, the short-term scheduler must be fast. 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 degree of multiprogramming. Because of the longer interval between executions, the long-term scheduler can afford to take more time to decide which process should be selected for execution.

Distinguish between coarse-grained and fine-grained multithreading.

Ans: There are two approaches to multithread a processor. (1) Coarse-grained multithreading allows a thread to run on a processor until a long-latency event, such as waiting for memory, to occur. When a long-latency event does occur, the processor switches to another thread. (2) Fine-grained multithreading switches between threads at a much finer-granularity, such as between instructions.

Explain the difference between response time and turnaround time. These times are both used to measure the effectiveness of scheduling schemes.

Ans: Turnaround time is the sum of the periods that a process is spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O. Turnaround time essentially measures the amount of time it takes to execute a process. Response time, on the other hand, is a measure of the time that elapses between a request and the first response produced.

Distinguish between virtualization and simulation

Ans: Virtualization is the process whereby the system hardware is virtualized, thus providing the appearance to guest operating systems and applications that they are running on native hardware. In many virtualized environments, virtualization software runs at near native speeds. Simulation is the approach whereby the actual system is running on one set of hardware, but the guess system is compiled for a different set of hardware. Simulation software must simulate — or emulate — the hardware that the guest system is expecting. Because each instruction for the guest system must be simulated in software rather than hardware, simulation is typically much slower than virtualization.

Explain the concept of a context switch.

Ans: Whenever the CPU starts executing a new process, the old process's state must be preserved. The context of a process is represented by its process control block. 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 context switch. When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saves context of the new process scheduled to run.

Using the program given below, identify the values of pid at lines A, B, C, and D. (Assume that the actual pids of the parent and child are 2600 and 2603, respectively.) #include < sys/types.h > #include < stdio.h > #include < unistd.h > int main() { pid t pid, pid1; /* fork a child process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); return 1; } else if (pid == 0) { /* child process */ pid1 = getpid(); printf("child: pid = %d",pid); /* A */ printf("child: pid1 = %d",pid1); /* B */ } else { /* parent process */ pid1 = getpid(); printf("parent: pid = %d",pid); /* C */ printf("parent: pid1 = %d",pid1); /* D */ wait(NULL); } return 0; }

Answer: A = 0, B = 2603, C = 2603, D = 2600

12. A(n) ______________ allows several unrelated processes to use the pipe for communication. A) named pipe B) anonymous pipe C) LIFO D) ordinary pipe

B

12. Which of the following statements concerning open source operating systems is true? A) Solaris is open source. B) Source code is freely available. C) They are always more secure than commercial, closed systems. D) All open source operating systems share the same set of goals.

B

What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach?

Benefits typically include the following: (a) adding a new service does not require modifying the kernel, (b) it is more secure as more operations are done in user mode than in kernel mode, and (c) a simpler kernel design and functionality typically results in a more reliable operating system. User programs and system services interact in a microkernel architecture by using interprocess communication mechanisms such as messaging. These messages are conveyed by the operating system. The primary disadvantages of the microkernel architecture are the overheads associated with interprocess communication and the frequent use of the operating system's messaging functions in order to enable the user process and the system service to interact with each other.

Describe the relationship between an API, the system-call interface, and the operating system.

The system-call interface of a programming language serves as a link to system calls made available by the operating system. This interface intercepts function calls in the API and invokes the necessary system call within the operating system. Thus, most of the details of the operating-system interface are hidden from the programmer by the API and are managed by the run-time support library.

10 . Which of the following is true in a Mach operating system? A) All messages have the same priority. B) Multiple messages from the same sender are guaranteed an absolute ordering. C) The sending thread must return immediately if a mailbox is full. D) It is not designed for distributed systems.

A

12. Microkernels use _____ for communication. A) message passing B) shared memory C) system calls D) virtualization

A

13. The _____ model multiplexes many user-level threads to a smaller or equal number of kernel threads. A) many-to-many B) two-level C) one-to-one D) many-to-one

A

13. Which of the following operating systems is not open source? A) Windows B) BSD UNIX C) Linux D) PCLinuxOS

A

What is a bootstrap program, and where is it stored?

Ans: A bootstrap program is the initial program that the computer runs when it is powered up or rebooted. It initializes all aspects of the system, from CPU registers to device controllers to memory contents. Typically, it is stored in read-only memory (ROM) or electrically erasable programmable read-only memory (EEPROM), known by the general term firmware, within the computer hardware.

Explain why a modular kernel may be the best of the current operating system design techniques.

Ans: The modular approach combines the benefits of both the layered and microkernel design techniques. In a modular design, the kernel needs only to have the capability to perform the required functions and know how to communicate between modules. However, if more functionality is required in the kernel, then the user can dynamically load modules into the kernel. The kernel can have sections with well-defined, protected interfaces, a desirable property found in layered systems. More flexibility can be achieved by allowing the modules to communicate with one another.

Name and describe the different states that a process can exist in at any given time

Ans: The possible states of a process are: new, running, waiting, ready, and terminated. The process is created while in the new state. In the running or waiting state, the process is executing or waiting for an event to occur, respectively. The ready state occurs when the process is ready and waiting to be assigned to a processor and should not be confused with the waiting state mentioned earlier. After the process is finished executing its code, it enters the termination state.

1. In what way is an operating system like a government? A) It seldom functions correctly. B) It creates an environment within which other programs can do useful work. C) It performs most useful functions by itself. D) It is always concerned primarily with the individual's needs.

B

1. ____ is a thread library for Solaris that maps many user-level threads to one kernel thread. A) Pthreads B) Green threads C) Sthreads D) Java threads

B

10. In multithreaded programs, the kernel informs an application about certain events using a procedure known as a(n) ____. A) signal B) upcall C) event handler D) pool

B

10. Two important design issues for cache memory are ____. A) speed and volatility B) size and replacement policy C) power consumption and reusability D) size and access privileges

B

11. _____ allow operating system services to be loaded dynamically. A) Virtual machines B) Modules C) File systems D) Graphical user interfaces

B

11. _____ is not considered a challenge when designing applications for multicore systems. A) Deciding which activities can be run in parallel B) Ensuring there is a sufficient number of cores C) Determining if data can be separated so that it is accessed on separate cores D) Identifying data dependencies between tasks.

B

14. A _____ provides a file-system interface which allows clients to create and modify files. A) compute-server system B) file-server system C) wireless network D) network computer

B

12. A ____ provides an API for creating and managing threads. A) set of system calls B) multicore system C) thread library D) multithreading model

C

13. The Windows CreateProcess() system call creates a new process. What is the equivalent system call in UNIX: A) NTCreateProcess() B) process() C) fork() D) getpid()

C

14. Imagine that a host with IP address 150.55.66.77 wishes to download a file from the web server at IP address 202.28.15.123. Select a valid socket pair for a connection between this pair of hosts. A) 150.55.66.77:80 and 202.28.15.123:80 B) 150.55.66.77:150 and 202.28.15.123:80 C) 150.55.66.77:2000 and 202.28.15.123:80 D) 150.55.66.77:80 and 202.28.15.123:3500

C

11. What are some other terms for kernel mode? A) supervisor mode B) system mode C) privileged mode D) All of the above

D

11. When communicating with sockets, a client process initiates a request for a connection and is assigned a port by the host computer. Which of the following would be a valid port assignment for the host computer? A) 21 B) 23 C) 80 D) 1625

D

____ scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU bursts. A) Multilevel queue B) RR C) FCFS D) SJF

D

The operating system kernel consists of all system and application programs in a computer (T or F)

F

There are two different ways that commands can be processed by a command interpreter. One way is to allow the command interpreter to contain the code needed to execute the command. The other way is to implement the commands through system programs. Compare and contrast the two approaches.

In the first approach, upon the user issuing a command, the interpreter jumps to the appropriate section of code, executes the command, and returns control back to the user. In the second approach, the interpreter loads the appropriate program into memory along with the appropriate arguments. The advantage of the first method is speed and overall simplicity. The disadvantage to this technique is that new commands require rewriting the interpreter program which, after a number of modifications, may get complicated, messy, or too large. The advantage to the second method is that new commands can be added without altering the command interpreter. The disadvantage is reduced speed and the clumsiness of passing parameters from the interpreter to the system program.

What are the benefits and the disadvantages of each of the following? Consider both the system level and the programmer level. a. Synchronous and asynchronous communication b. Automatic and explicit buffering

Synchronous and asynchronous communication—A benefit of synchronous communication is that it allows a rendezvous between the sender and receiver. A disadvantage of a blocking send is that a rendezvous may not be required and the message could be delivered asynchronously. As a result, message-passing systems often provide both forms of synchronization. Automatic and explicit buffering—Automatic buffering provides a queue with indefinite length, thus ensuring the sender will never have to block while waiting to copy a message. There are no specifications on how automatic buffering will be provided; one scheme may reserve sufficiently large memory where much of the memory is wasted. Explicit buffering specifies how large the buffer is. In this situation, the sender may be blocked while waiting for available space in the queue. However, it is less likely that memory will be wasted with explicit buffering.

What are the five major activities of an operating system in regard to file management?

The creation and deletion of files The creation and deletion of directories The support of primitives for manipulating files and directories The mapping of files onto secondary storage The backup of files on stable (nonvolatile) storage media

Describe three general methods used to pass parameters to the operating system during system calls.

The simplest approach is to pass the parameters in registers. In some cases, there may be more parameters than registers. In these cases, the parameters are generally stored in a block, or table, of memory, and the address of the block is passed as a parameter in a register. Parameters can also be placed, or pushed, onto the stack by the program and popped off the stack by the operating system.

Consider the following code segment: pid t pid; pid = fork(); if (pid == 0) { /* child process */ fork(); thread create( . . .); } fork(); a. How many unique processes are created? b. How many unique threads are created?

There are six processes and two threads.

Under what circumstances does a multi-threaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system?

When a kernel thread suffers a page fault, another kernel thread can be switched in to use the interleaving time in a useful manner. A singlethreaded process, on the other hand, will not be capable of performing useful work when a page fault takes place. Therefore, in scenarios where a program might suffer from frequent page faults or has to wait for other system events, a multithreaded solution would perform better even on a single-processor system.

Is it possible to have concurrency but not parallelism? Explain.

Yes. Concurrency means that more than one process or thread is progressing at the same time. However, it does not imply that the processes are running simultaneously. The scheduling of tasks allows for concurrency, but parallelism is supported only on systems with more than one processing core.

Describe the differences among short-term, medium-term, and long-term scheduling.

a. Short-term (CPU scheduler)—selects from jobs in memory those jobs that are ready to execute and allocates the CPU to them. b. Medium-term—used especially with time-sharing systems as an intermediate scheduling level. A swapping scheme is implemented to remove partially run programs from memory and reinstate them later to continue where they left off. c. Long-term (job scheduler)—determines which jobs are brought into memory for processing. The primary difference is in the frequency of their execution. The shortterm must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system and may wait a while for a job to finish before it admits another one.


Conjuntos de estudio relacionados

Driving School Unit One (Finished)

View Set

Combo with "Combo with "Honors World History Final" and 27 others" and 19 others

View Set

Chapter 5. The Court System in Texas

View Set

Anatomy Honors - Unit 3 Tissues Test

View Set

MED SURG NUR 440 Final Comp Exam

View Set

Chapter 7- Mental Imagery and Cognitive Maps

View Set