When a timer interrupt occurs the operating system

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4 [Category 2]: Consider the following program: code/ecf/forkprob2.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include "csapp.h" void end(void) { printf("2"); } int main() { if (Fork() == 0) atexit(end); if (Fork() == 0) printf("0"); else printf("1"); exit(0); } code/ecf/forkprob2.c Determine which of the following outputs are possible. Note: The atexit function takes a pointer to a function and adds it to a list of functions (initially empty) that will be called when the exit function is called. A. 112002 8.8. SUMMARY B. 211020 C. 102120 D. 122001 E. 100212 445 Homework Problem 8.15 [Category 2]: Use execve to write a program, called myls, whose behavior is identical to the /bin/ls program. Your program should accept the same command line arguments, interpret the identical environment variables, and produce the identical output. The ls program gets the width of the screen from the COLUMNS environment variable. If COLUMNS is unset, then ls assumes that the sc...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online