Operating System in C assignment

Computer Science
Price: $30 USD

Question description

Task 1

The goal of this assignment is to make sure you fully comprehend (and are able to realize) the creation of processes with Unix-like operating systems. To this end you will be using the fork() system call.

You are to write a very simple shell program, similar to

while (TRUE) { /* repeat forever */

print_prompt( ); /* display prompt */

read_command (command, parameters)!/* input from terminal */

if (fork() != 0) { /* fork off child process */

/* Parent code */

waitpid( -1, &status, 0);! /* wait for child to exit */

} else {

/* Child code */

execve (command, parameters, 0); /* execute command */



The shell should terminate if the user enters “exit” at the command line, and should attempt to launch a program in response to any other input string. You do not have to parse any parameters, nor do you need to support background execution of processes. The simplest possible shell to demonstrate is all that is required. You may wish to write a “hello world” program, so that you have an executable file that you could launch from your shell.

Task 2

You are to write a program that will create exactly seven child processes (not including the initial program itself). You are not to allow any single process to create more than two child processes.

Task 3

You are to write a program that, when launched, will result in a total of nine child processes to run. This is the same task as described above, but this time you are not to allow any single process to create less than two child processes, or more than three. In other words, the program you write can only launch a maximum of three child processes directly, and any other “children” will have to be created by the children of this parent process (subject to the restriction of only creating two or three processes each). Once again, any process that creates other processes must create either two or three processes only, no more and no less.

Tutor Answer

(Top Tutor) Daniel C.
School: University of Maryland
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1823 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors