Question: Code in Linux An operating system usually has a pid manager which is responsible for managing process identifiers When a process is first created, it

Code in Linux  Code in Linux An operating system usually has a pid manager

An operating system usually has a pid manager which is responsible for managing process identifiers When a process is first created, it is assigned a unique pid by the pid manager. The pid is returned to the pid_manager when the process completes execution, and the manager may later reassign this pid to a new process. It is very important though, that no two active processes can have the same pid. Even though this is not the best implementation, please use an array of characters to represent and track the availability of the pid numbers. A O' in position i indicates that a process id of value i is available and a value of '1' indicates that the process id is currently in use. A better strategy is to adopt what Linux does and use a bitmap instead of the character array. Implement the following functions to obtain and release a pid int allocate map (void): Creates and initializes a data structure for representing pids; returns -1 if unsuccessful, 1 if successful int allocate _pid (void): Allocates and returns a pid; returns -1 if unable to allocate a pid (all pids are in use) - int release pid(int pid) : Releases a pid Write a short main program to test your functions and use the following range for the available pid numbers: #define MIN PID 300 #define MAXPID 5000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!