Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

P2) 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

image text in transcribed

P2) 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 '0' 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 picd numbers #define MINPID 300 #de fine MAX PID 5000 - P2) 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 '0' 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 picd numbers #define MINPID 300 #de fine MAX PID 5000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

8. Providing support during instruction.

Answered: 1 week ago