logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Max ManuelaMarketing
(5/5)

955 Answers

Hire Me
expert
Jane SimaEducation
(5/5)

789 Answers

Hire Me
expert
Julian ClaryCriminology
(5/5)

576 Answers

Hire Me
expert
Jeremiah BennettComputer science
(5/5)

908 Answers

Hire Me
Operating System

this assignment creates the pid manager whose implementation can simply be a single class. Of course, you can create any other classes you might need to implement the pid manager.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Process ID Assignment

Overview

An operating system’s pid manager is responsible for managing process identifiers. At process creation, the pid manager assigns the process a unique pid. When the process completes execution, it returns the pid to the pid manager which in turn may later reassign this pid to another process. Chapter 3 provides a full discussion of process identifiers. What is most important here is recognizing that process identifiers must be unique; no two active processes can have the same pid.

 

Design

  1. The first task in this assignment creates the pid manager whose implementation can simply be a single class. Of course, you can create any other classes you might need to implement the pid manager. You may use any data structure of your choice to represent the availability of process identifiers. One strategy adopts Linux’s approach of a bitmap in which a value of 0 at 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. Use the following constants to identify the range of possible pid values: MIN_PID is 300 and MAX_PID is

 

Have your pid manager implement the following API for obtaining and releasing a pid:

  • int allocate map( ) – Creates and initializes a data structure for representing pids; returning 0 if unsuccessful or 1 if

  • int allocate pid( ) – Allocates and returns a pid; returns 1 if unable to allocate a pid, all pids are in

  • void release pid(int pid) – Releases a

 

  1. The second task in this assignment consists of writing a multithreaded program that tests your pid manager. Implementing the threads uses either extends Thread or implements Runnable. Create a number of threads where each thread requests a pid, sleeps for a random period of time, releases the pid, and then terminates. Sleeping for a random period of time approximates the typical pid usage in which a new process acquires a pid, the process executes and then terminates, releasing the pid upon its termination. Download the java file needed for the assignment. A thread sleeps by calling the SleepUtilities.nap(duration) function, passing an integer value representing the number of seconds to sleep, where duration is a randomly generated integer between 60 and 300. Before sleeping, each thread should print out (on a new line) the message, “My PID is: x.”, where x is the actual pid for the thread.

 

  1. Create a driver class and make the name of the driver class Assignment1 containing only one method:

public static void main(String args[]).

The main method itself is fairly short containing code to do the following:

  1. Create the pid manager

  2. Create 100

  3. For each thread, pass the pid manager into the thread and begin the execution of the

  4. The main method needs to keep track of the threads and take care of each thread before it can end. The methods of the Thread class you'll need for this are join() and isAlive(). If the thread is dead then execute a join on it in order to properly dispose of that thread. If the thread is still alive then move on to the next thread. The main method keeps doing this check until the last remaining thread has died and been properly

 

  1. You must declare public each class you create which means you define each class in its own

 

  1. You must declare private the data members in every class you

 

  1. You can only use extends in this assignment (extends Thread) when defining your thread class. Though, you don’t have to use “extends Thread” to define your thread class. Remember, “implements Runnable” is the other way in Java to define your thread

 

  1. Tip: Make your program as modular as possible, not placing all your code in one .java file. You can create as many classes as you need in addition to the classes described above. Methods being reasonably small follow the guidance that "A function does one thing, and does it well." You will lose a lot of points for code readability if you don’t make your program as modular as possible. But, do not go overboard on creating classes and methods. Your common sense guides your creation of classes and

 

  1. Do NOT use your own packages in your program. If you see the keyword package on the top line of any of your .java files then you created a package. Create every .java file in the src folder of your Eclipse project, if you’re using

 

  1. Do NOT use any graphical user interface code in your program!

 

  1. Do NOT type any comments in your program. If you do a good job of programming by following the advice in number 7 above then it will be easy for me to determine the task of your

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme