Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7711497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:23:24+00:00 2026-06-01T01:23:24+00:00

i was given an assignment . Write a program to simulate job scheduling in

  • 0

i was given an assignment .

Write a program to simulate job scheduling in an operating system.
Jobs are generated at random times. Each job is given both a random
priority from 1 to 4 – where 1 is the highest priority –and a random
amount of time to complete its execution.

Jobs do not begin execution and run to completion, but instead share
the processor. The operating system executes a job for a fixed unit
of time called time slice. At the end of the time slice, the current
job’s execution is suspended. The job is then placed on a priority
queue, where it waits for its next share of processor time. The job
having the highest priority is then removed from the priority queue
and executed for a time slice. When a job is first generated, it will
begin executing immediately if the processor is free. Otherwise it
will be placed on the priority queue.

In this assignment, you will need an implementation of a queue and a
priority queue. You can use the priority queue in the Java Class
Library (java.util.PriorityQueue). It implements the interface
java.util.Queue.

im confuse with time slice and execution time..
as my understanding for now is let say final int timeslice=3, the time to complete all job is final int clock=20 minutes.;
when job A begin at 0 minute has execution time of 5(which is randomly generated between 1-5).
while executing the job till minute 3.Job A is put into priority queue while Job B with execution time of 2 minute enters at minute 3? after finish executing Job B, Job A enter to finish executing or Job C ?

please explain if im wrong. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:23:26+00:00Added an answer on June 1, 2026 at 1:23 am

    In your question of whether Job A or Job C is executed (once B is complete) it should depend what the PriorityQueue returns, which will be the job with the highest priority.

    If Job A had a priority of 1 and Job C a priority of 2, PriorityQueue would return Job A and that should get the next time slice.

    If Job C had a priority of 2 and Job B a priority of 4, PriorityQueue would return Job C and that should get the next time slice.

    As adn_295 says, this is a good assignment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently for a programming class, we were given the assignment to write a program
I was given an assignment to write a program to print only even numbers
A while back we were given an assignment to write a c program that
I was given the following HomeWork assignment, Write a program to test on your
I'm trying write a C program that sends an UDP packet to a given
My class assignment is to write a program that has the user input a
I have an assignment in my C programming class to write a program to
For class I have an assignment: Write a C++ program that will output the
My boss have given me assignment to find how a web based application developed
So I've been given an assignment in my Mobile apps class: make a color

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.