Presentation of practical exercise 3 - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Presentation of practical exercise 3

Description:

... most interesting as it implements the Round Robin process scheduling algorithm. ... Example: The arrival of a new process. ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 16
Provided by: ottarvik
Category:

less

Transcript and Presenter's Notes

Title: Presentation of practical exercise 3


1
Presentation of practical exercise 3
  • Queuing networks
  • Process scheduling
  • Event-driven simulation

2
A basic computer system
  • Consists of a CPU, a memory unit and I/O devices,
    connected by buses.
  • The operating system must control and facilitate
    the use of these resources.
  • The OSs clients are processes executing
    application programs.
  • The OS controls the processes use of and access
    to the hardware resources.

3
Queuing networks
  • Queuing networks are used to study the
    performance of computer systems.
  • A queuing network abstracts a system into a
    network of interconnected resources with
    associated queues of requests.
  • We will consider a QN of our basic computer
    system, and use it to study process scheduling.

4
Our queuing network
Processes (requests) in queue
Resources with queues
Processes (requests) currently being processed
5
How the QN works
  • Processes enter the system by entering the memory
    queue.
  • When a process has been allocated the required
    amount of memory, it is ready to start execution,
    so it enters the CPU queue.
  • When a process is done executing, it leaves the
    CPU and the system.
  • While processing, a process may need to perform
    I/O. In that case, it leaves the CPU and enters
    the I/O queue. When the I/O is done, it reenters
    the CPU queue to continue processing.

6
Allowing for multiprogramming
  • The system is able to serve multiple processes
    simultaneously.
  • This is done by queuing processes, and
    time-slicing their access to the CPU, using the
    Round Robin algorithm.
  • When a process has used up its time slice it is
    removed from the CPU and inserted at the end of
    the CPU queue to enable waiting processes to use
    the CPU.
  • This introduces another path in the QN

Time slice exhausted
7
The exercise
  • The QN has been partially implemented in Java.
    You must complete it.
  • The GUI, the Queue class and the simulation
    framework has been implemented.
  • The memory unit has been implemented, you need to
    implement the CPU and the I/O device.
  • The CPU part is the most interesting as it
    implements the Round Robin process scheduling
    algorithm.

8
Simulation parameters
  • These parameters are inputted by the user at the
    start of the simulation
  • Available memory.
  • The length of the Round Robin time slice.
  • Average duration of an I/O operation.
  • Average time between the arrivals of new
    processes.
  • Total simulation time.

9
Process characteristics
  • Each process that arrives has some properties
    that are randomly generated
  • Memory required (100 KB ? 25 of total memory)
  • Runtime or CPU-time (100ms ? 10000ms)
  • Average time between I/O operations
    (1 ? 25 of runtime)
  • NB Runtime means time spent in the CPU,
    excluding time spent in I/O

Lifetime
Runtime
10
The simulation framework
  • The simulator uses a queue of events to simulate
    the workings of the queuing network.
  • An event occurs every time a process is moved
    from one resource/queue to another in the QN.
  • The event queue holds future events. The events
    are kept chronologically sorted. The main loop
    repeatedly removes the first event from the event
    queue and processes it.
  • This means that the simulation proceeds in
    discrete time steps.
  • The processing of an event can lead to processes
    being moved around in the QN, and it can lead to
    new events being added to the event queue.

11
Event processing
  • Example The arrival of a new process.
  • This event is of type NEW_PROCESS defined in the
    Constants interface.
  • When a NEW_PROCESS event is removed from the
    event queue, a new Process object is created and
    added to the memory queue.
  • If there is enough memory to allocate to the
    newly created process, it is immediately moved on
    to the CPU queue.
  • If the CPU queue is empty, the process
    immediately enters the CPU, and a new event will
    be added to the event queue.

12
Event processing
  • Depending on random variables and the simulation
    parameters, the event added to the event queue is
    one of the following
  • SWITCH_PROCESS if the process is allowed to
    exhaust its time slice and then must yield the
    CPU to waiting processes.
  • IO_REQUEST if the process will need to perform
    some I/O operation before the time slice is
    exhausted.
  • END_PROCESS if the process will complete its
    execution before the time slice is exhausted.
  • When the NEW_PROCESS event has been processed,
    the time until the next process arrival is
    determined, and a new NEW_PROCESS event for that
    arrival is created and added to the event queue.

13
Event processing
  • Processing routines must be written for the
    SWITCH_PROCESS, END_PROCESS and IO_REQUEST event
    types as well.
  • The fifth and final event type is END_IO, which
    marks the completion of an I/O operation.
  • This event is added to the event queue when a
    IO_REQUEST event is processed.
  • The processing of this event involves moving a
    process from the I/O device to the CPU queue, and
    starting a new I/O operation if there are any
    processes waiting in the I/O queue.
  • If the CPU queue was originally empty, the
    process that entered the queue immediately enters
    the CPU, as described earlier.
  • The event processing routines drive the
    simulation forward !

14
Your tasks
  • Complete the partial solution. This involves
    completing the classes Process, Simulator, Cpu
    and Io.
  • Use your solution to explore the effects of
    varying the different simulation parameters.
  • Hand in a report including your source code and
    the results of your experiments.
  • The program must be demonstrated to one of the
    assistants.

15
Hints
  • Study the partial solution to understand how the
    program works.
  • The Cpu and Io classes will resemble the Memory
    class, but are a bit more complicated.
  • Take advantage of the notes from this lecture
    when writing code for processing events.
  • Use the methods in the Gui interface to update
    the GUI during the simulation. This will enable
    you to see how your QN works.
  • You can run the handed out code by running the
    P3.bat batch file. In the partial solution,
    processes completely bypass the CPU and IO
    resources, as these parts of the system are
    missing.
Write a Comment
User Comments (0)
About PowerShow.com