Question: Use Java language to write this program An operating systems pid manager is responsible for managing process identifiers. When a process is first created, it
Use Java language to write this program
An operating systems pid manager 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. Process identifiers must be unique; no two active processes may have the same pid.
# define MIN_PID 500
# define MAX_PID 6000
You may use any data structure of your choice to represent the availability of process identifiers. One strategy is to adopt what Linux has done and use a bitmap in which a value of 0 at position/ indicates that a process id of value/ is available and a value of 1 indicates that the process id is currently in use
- int allocate_map(void)- create and initializes a data structure for representing pids; return - 1 if unsuccessful and 1 if successful
- int allocate_pid(void) - Allocates and returns a pid; return - 1 if unable to allocate a pid(all kids are in use)
- void release_pid(int_pid) - Releases a pid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
