0% found this document useful (0 votes)
10 views2 pages

CFL Assessment 1

fefr2erq35tqtq56

Uploaded by

zainmediateam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

CFL Assessment 1

fefr2erq35tqtq56

Uploaded by

zainmediateam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSCI 430L – Operating Systems Lab

Assessment 1

Exercise 1 : Starting from the root directory, use the appropriate Linux shell commands to complete the
following tasks:
1. Change your current directory to the Desktop.

2. List all the files and directories located on the Desktop.

3. Create a new directory on the Desktop named "project".

4. Navigate to the "project" directory you just created.

5. Create a text file called "data.txt" inside the "project" directory.

6. Copy "data.txt" from "project" to the Desktop and rename it "backup_data.txt".

7. Rename the file "backup_data.txt" to "final_backup.txt".

8. Delete the "project" directory and all of its contents.

9. Create a new file named "sample.c" on the Desktop.

10. Open "sample.c" using the nano text editor without closing the terminal window.

11. Compile "sample.c" into an executable named "sample_program.out".

12. Execute the program "sample_program.out".

13. List all files and directories on the Desktop along with their detailed properties, including

permissions and size.


Exercise 2 : Open the terminal. Navigate to the desktop and create a new directory named "Ex_2". Inside the
directory, type gedit Exercise2.c In the C file, write a program that forks a child process where:

1- The parent process prints its ID, its child's ID, and the message "Parent process is executing!".
2- The child process prints its ID, its parent's ID, the message "Child process is starting...", exits immediately,
and the parent process waits for it to finish and prints "Parent process finished".

The libraries you need to include are: stdio.h, stdlib.h, unistd.h, sys/wait.h

A sample run:
Parent:
myid = 3000
my child's id = 3001
Parent process is executing!
(child exits immediately)

Child:
myid = 3001
my parent's id = 2576
Child process is starting...
Child process finished

Parent process finished

You might also like