Section 1

Preview this deck

Describe the actions taken by a kernel to context-switch between processes.

Front

Star 100%
Star 100%
Star 100%
Star 0%
Star 0%

3.0

1 review

5
0
4
0
3
1
2
0
1
0

Active users

3

All-time users

3

Favorites

0

Last updated

1 year ago

Date created

Mar 1, 2020

Cards (14)

Section 1

(14 cards)

Describe the actions taken by a kernel to context-switch between processes.

Front

The operating system must save the state of the currently running process and restore the state of the process scheduled to be run next. Saving the state of a process typically includes the values of all the CPU registers in addition to memory allocation. Context switches must also perform many architecture-specific operations, including flushing data and instruction caches.

Back

Including the initial parent process, how many processes are created by the program shown in Figure 3.31 in your textbook?

Front

8 processes are created. The program online includes printf() statements to better understand how many processes have been created.

Back

Give an example of a situation in which ordinary pipes are more suitable than named pipes and an example of a situation in which named pipes are more suitable than ordinary pipes

Front

Simple communication works well with ordinary pipes. For example, assume we have a process that counts characters in a file. An ordinary pipe can be used where the producer writes the file to the pipe and the consumer reads the files and counts the number of characters in the file. Consider the situation where several processes may write messages to a log. When processes wish to write a message to the log, they write it to the named pipe. A server reads the messages from the named pipe and writes them to the log file

Back

Timers could be used to compute the current time. Provide a short description of how this could be accomplished.

Front

The program could set a timer for some time in the future and go to sleep. When interrupted, it could update number of interrupts. It could then repeat this process of continually setting timer interrupts and updating its local state when the interrupts are actually raised.

Back

How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system?

Front

Certain instructions could be executed only when the CPU is in kernel mode. Hardware devices could be accessed only when the program is executing in kernel mode.

Back

What is a zombie? Why does the zombie problem arise? Why must wait() be called on children?

Front

If a parent forks a child, but does not issue a wait() after the child terminates, the terminated child becomes a zombie process. • Zombie process: a terminated process whose PCB was not deallocated i.e. PCB contains child's exit code e.g. the code returned by int main(). • The child will remain a zombie until the parent calls wait().

Back

1. What are the three main purposes of an operating system?

Front

1. To provide an environment for a computer user to execute programs 2. To allocate the separate resources of the computer 3. supervision of the execution of user programs to prevent errors and improper use , and the management of I/O devices.

Back

What is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated intentionally by a user program? If so, for what purpose?

Front

An interrupt is a hardware‐generated change‐of‐flow within the system. A trap is a software‐generated interrupt. An interrupt can be used to signal he completion of an I/O to obviate the need for device polling. A trap can be used to call operating system routines or to catch arithmetic errors.

Back

What are short, long and medium-term scheduling?

Front

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.

Back

What are the benefits and the disadvantages of Synchronous and asynchronous communication? (Consider both the system level and the programmer level.)

Front

A benefit of synchronous communication is that it allows a meeting 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.

Back

When a process creates a new process using the fork() operation, which of the following state is shared between the parent process and the child process? a. Stack b. Heap c. Shared memory segments

Front

Only the shared memory segments are shared between the parent process and the newly forked child process. Copies of the stack and the heap are made for the newly created process

Back

What is the output of the following code? Please test it on Linux. (an actual interview question) int main ( ) { fork ( ) ; fork ( ) ; f ork ( ) ; fprintf ( stderr , " Hello/ n" ) ; }

Front

Print's Hello eight times

Back

Distinguish between the client-server and peer-to-peer models of distributed systems.

Front

The client-server model firmly distinguishes the roles of the client and server. The client requests services that are provided by the server. The peer-to-peer model doesn't have such strict roles. A node may request a service from another peer.

Back

What is the difference between an orphan and zombie?

Front

Zombie process is when child terminates, but wait() isn't called while orphan process is when parent process terminates instead of calling wait() on the child.

Back