Operating System Lab 04 Solution

$30.00 $24.00

Lab Activity Activity 1) Write a program that accomplish the following purpose: Call the system call to create the child process and store the value returned from the call. If the returned value is less than zero, Print ‘Unsuccessful Child Process Creation”. ii. Terminate using exit system call If the return value is greater than…

Rate this product

You’ll get a: zip file solution

 

Description

Rate this product

Lab Activity

Activity 1)

Write a program that accomplish the following purpose:

  1. Call the system call to create the child process and store the value returned from the call.

    1. If the returned value is less than zero,

      1. Print ‘Unsuccessful Child Process Creation”. ii. Terminate using exit system call

    1. If the return value is greater than zero

      1. Add a wait system call so that the parent would wait for child process to complete.

      1. Make a loop that prints even numbers from 1 – 10

      1. Print “Parent Ends”

    1. If the return value is equal to zero

      1. Print the parent ID

      1. Make a loop that prints odd numbers from 1 – 10 iii. Print “Child Ends”

  1. Stop

Activity 2)

Write a program to declare a counter variable initialized by zero. After fork() system call two processes will run in parallel both incrementing their own version of counter and print numbers 1 -5 . After printing numbers child process will sleep for three second, then print process id of its grandparent and terminates by invoking a gedit editor. Meanwhile, its parent waits for its termination.

Activity 3)

Write a program which creates processes 4 processes for parallel programming. Each parent will wait for the termination of its child.

Main process

Process P1 waiting for

Process p2 waiting for

Process p3 runs a bash

p2

p3

command

Activity 4)

Google execl(), execlp() system call and study more about it than what is written in the manual.

https://www.mkssoftware.com/docs/man3/execl.3.asp

Activity 5)

Implement the following 9 tree structure. Each node must print its name and PID.

e.g. I am Process A and my PID is 2453

Operating System Lab 04 Solution
$30.00 $24.00