Homework 2 Questions - Operating Systems | CMSC 412, Assignments of Operating Systems

Material Type: Assignment; Professor: Spring; Class: Operating Systems; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-mi3-1
koofers-user-mi3-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 412 Homework Two
Name:
Read Chapter 3
Due Tuesday Sept 16.
1. What interrupt is a geekos system call?
2. The following is the first several lines of ps -alx on heaving.csic.umd.edu.
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 0 1 0 15 0 1532 500 - S ? 0:43 init
5 0 2 0 -100 0 0 0 - SW ? 0:00 [migration/0]
5 0 3 0 -100 0 0 0 - SW ? 0:00 [migration/1]
1 0 4 1 15 0 0 0 - SW ? 0:00 [keventd]
1 0 5 1 34 19 0 0 - SWN ? 0:00 [ksoftirqd/0]
1 0 6 1 34 19 0 0 - SWN ? 0:00 [ksoftirqd/1]
1 0 9 1 15 0 0 0 - SW ? 0:00 [bdflush]
1 0 7 1 15 0 0 0 - SW ? 0:13 [kswapd]
1 0 8 1 15 0 0 0 - SW ? 0:18 [kscand]
1 0 10 1 15 0 0 0 - SW ? 0:41 [kupdated]
1 0 11 1 25 0 0 0 - SW ? 0:00 [mdrecoveryd]
(a) What does the “F” stand for?
(b) Is “migration” a high- or low-priority process?
(c) What does the N in STAT signify?
(d) Why are nearly all of these commands in square brackets?
(e) (bonus question) Why do two processes have /0 and /1 suffixes?
3. 3.3 When a process creates a new process using the fork() operations, which of the following states is shared
between the parent process and the child process? (a) stack (b) heap (c) shared memory segments.
4. 3.4 With respect to the RPC mechanism, consider the “exactly once” semantic. Does the algorithm for implement-
ing this semantic execute correctly even if the ACK message back to the client is lost due to a network problem?
Describe the sequence of messages and discuss whether “exactly once” is still preserved.
5. 3.6 Describe the differences among short-term, medium-term, and long-term scheduling.
6. 3.7 Describe the actions taken by a kernel to context-switch between processes.
7. 3.9 Including the initial parent process, how many processes are created by the [following program]:
#include <unistd.h> // stdio totally not needed.
int main() {
fork(); fork(); fork();
exit(EXIT_SUCCESS);
}
8. 3.11 Give an example of
(a) a situation in which ordinary pipes are more suitable than named pipes, and
(b) an example of a situtation in which named pipes are more suitable than ordinary pipes.
Page 1 of 2
pf2

Partial preview of the text

Download Homework 2 Questions - Operating Systems | CMSC 412 and more Assignments Operating Systems in PDF only on Docsity!

CMSC 412 Homework Two

Name: Read Chapter 3 Due Tuesday Sept 16.

  1. What interrupt is a geekos system call?
  2. The following is the first several lines of ps -alx on heaving.csic.umd.edu.

F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 1 0 15 0 1532 500 - S? 0:43 init 5 0 2 0 -100 0 0 0 - SW? 0:00 [migration/0] 5 0 3 0 -100 0 0 0 - SW? 0:00 [migration/1] 1 0 4 1 15 0 0 0 - SW? 0:00 [keventd] 1 0 5 1 34 19 0 0 - SWN? 0:00 [ksoftirqd/0] 1 0 6 1 34 19 0 0 - SWN? 0:00 [ksoftirqd/1] 1 0 9 1 15 0 0 0 - SW? 0:00 [bdflush] 1 0 7 1 15 0 0 0 - SW? 0:13 [kswapd] 1 0 8 1 15 0 0 0 - SW? 0:18 [kscand] 1 0 10 1 15 0 0 0 - SW? 0:41 [kupdated] 1 0 11 1 25 0 0 0 - SW? 0:00 [mdrecoveryd]

(a) What does the “F” stand for? (b) Is “migration” a high- or low-priority process? (c) What does the N in STAT signify? (d) Why are nearly all of these commands in square brackets? (e) (bonus question) Why do two processes have /0 and /1 suffixes?

  1. 3.3 When a process creates a new process using the fork() operations, which of the following states is shared between the parent process and the child process? (a) stack (b) heap (c) shared memory segments.
  2. 3.4 With respect to the RPC mechanism, consider the “exactly once” semantic. Does the algorithm for implement- ing this semantic execute correctly even if the ACK message back to the client is lost due to a network problem? Describe the sequence of messages and discuss whether “exactly once” is still preserved.
  3. 3.6 Describe the differences among short-term, medium-term, and long-term scheduling.
  4. 3.7 Describe the actions taken by a kernel to context-switch between processes.
  5. 3.9 Including the initial parent process, how many processes are created by the [following program]:

#include <unistd.h> // stdio totally not needed. int main() { fork(); fork(); fork(); exit(EXIT_SUCCESS); }

  1. 3.11 Give an example of (a) a situation in which ordinary pipes are more suitable than named pipes, and (b) an example of a situtation in which named pipes are more suitable than ordinary pipes.

Page 1 of 2

CMSC 412 Homework Two

  1. 3.13 What’s printed by this program?

#include <sys/types.h> #include <stdio.h> #include <unistd.h> int value = 5; int main() { pid_t pid = fork(); if(pid == 0) { value += 15; } else if(pid > 0) { wait(NULL); printf("PARENT: value = %d", value); } exit(EXIT_SUCCESS); }

Page 2 of 2