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

08 Processes-TP

Tp unix command
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)
12 views2 pages

08 Processes-TP

Tp unix command
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

Lesson 05 – (TP) Date: 14/10/2024

Course: Operating Systems Lab: Intro to C-programming and Processes

Lab-1 Write a simple C program that takes two integer inputs from the user, stores their sum in a
third variable, and prints the sum. Compile the program using the GCC compiler.

Lab-2 Write a C program that takes an integer input from the user and prints all odd numbers starting
from 1 up to the given range. Compile the program using the GCC compiler.

Lab-3 Write a C program that takes two integer inputs from the user: one for the range and the other
for a common difference. The program should print a series of numbers starting from 1, where
each subsequent number increases by the given common difference, until the range is reached
or exceeded. Compile the program using the GCC compiler.

Lab-4 Write a C program that uses fork() to create a child process. The parent and child processes
print their process IDs (PID) and a simple message. Ensure that the child process is created
successfully and that both processes terminate gracefully.

Lab-5 Write a C program that uses fork() to create the following tree of processes.
Process A creates B and C. Process B creates D, E. Process E creates process F. Process C
creates process K. Process K creates process L. Process L creates process M.

B C

D E K

L
F
M

Lab 6 Write a C program that creates two processes. One process prints a multiplication table of 5
and the other process prints a multiplication table of 7.

Page 1 of 2
Lab7 Write a C program that creates two processes. The parent process reads the user input and
print the prime numbers. The child process reads the user input and prints the factorial. The
child process executes first. The parent process waits until child finishes and then starts
processing its instructions.

Lab 8 Update Lab 3 in such a way that child and parent process executes concurrently
(simultaneously).

Page 2 of 2

You might also like