Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All programs should be in C language. Write a C language program to demonstrate creation and execution of a child process through fork( function. Use
All programs should be in C language.
Write a C language program to demonstrate creation and execution of a child process through fork( function. Use getpid0 and getppid0 functions to print IDs of child and parent processes. I Write a program that reads the details of 5 programs into an array of structures. Use the following typedef. Your program should then display the contents of each PCB on the screen as shown below: typedef struct { int id; char name[10] owner; int memory: char status[15]; } PCB; ; CURRENT JOBS ID OWNER 10 Khalid 21 Hamza 23 System 56 Khalid 70 Khalid MEMORY (MB) 10 3 20 2 35 STATUS Running Ready Waiting Ready Ready The file, memory.txt, contains data records of memory and disk requirements (in MB) for five processes currently running on a computer. Each data record (line in the "memory.txt" file) consists of two values, memory requirement (MB) and disk requirement (MB) for one process. Write a program that reads the data from this file and computes the total memory and disk requirements for all the processes. Your result should be stored in a file, total_memory.txt, as shown below: Note: Each call to fscanf should read 2 values (memory requirement and disk requirement). Use a for loop to carry out repetition. memory.txt 200 100 90 10 20 10 50 30 0 10 total memory.txt Total memory requirement is 420 MB Total disk requirement is 100 MBStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started