Understanding Time Slice and Execution Time
<p>i was given an assignment . </p>

<blockquote>
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
</blockquote>

<p>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 ? </p>

<p>please explain if im wrong. Thanks</p>
