

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Spring; Class: Operating Systems; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CMSC 412 Homework Two
Name: Read Chapter 3 Due Tuesday Sept 16.
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?
#include <unistd.h> // stdio totally not needed. int main() { fork(); fork(); fork(); exit(EXIT_SUCCESS); }
Page 1 of 2
CMSC 412 Homework Two
#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