Comet.lehman.cuny.edu



Operating Systems

Assignment 1

Department of Mathematics and Computer Science,

Lehman College, the City University of New York, Spring 2012

Due by midnight February 23 (Thursday), 2012

Preparation

For this assignment, you need to set up and become familiar with a virtual machine environment (Oracle Virtual Box 4.x), or a recent Linux system (Fedora 13, 14, 15, 16, Ubuntu 10, 11). There are two options:

1. Install Virtual Box in your PC/Windows or Mac/Mac-OS X. Create a virtual machine on Virtual Box, then install Linux as a guest operating system in the virtual machine. You can create multiple virtual machines in the Virtual Box and install various Linux guest operating systems in the created virtual machines. You may consider installing MS Windows (XP-SP3 or Windows 7) as a guest OS in a Linux host.

2. Or on any hardware system that you can control, you need to install a Linux system (Fedora, CentOS, Ubuntu, Ubuntu Server).

Tasks to Be Performed

• Write the following programs as explained below. Show how to compile and run the programs by typescript ($script outfile). You need to show your source program by a command (e.g., $cat –n prog.c).

• Write a document including typescript file and answers to the questions and send the document to:

gwang.jung@lehman.cuny.edu

With Subject: OS Sp12-A1 [FirstName.LastName]

[Q.1] Program 1 (fork.c)

#include

#include

#include

#include

int g = 2;

int main(void)

{

pid_t pid;

int l = 3;

printf("process id(%d): parent g=%d, l=%d\n", getpid(), g, l);

if((pid=fork()) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download