Experimental three-process scheduling simulation experiment

Source: Internet
Author: User

13 Internet of Things 201306104107 Huang

1. Purpose and Requirements

Experiment Objective 13 Internet of things 201306104107 Huang

A process scheduler is completed in a high-level language to deepen the understanding of process concepts and process scheduling algorithms.

Experimental requirements

Design a process scheduling simulator with n (n not less than 5) processes executing concurrently.

Process scheduling algorithm: "Time slice rotation method" scheduling algorithm to n processes.

2. Experimental content

The design, coding and debugging of two algorithms (Simple time slice rotation method and multistage feedback queue scheduling algorithm) are completed, and the experimental report is completed.

1) Each process has a Process Control block (PCB) representation. The Process Control block contains the following information: Process name, priority, arrival time, required run time, elapsed CPU time, process state, and so on.

2) The status of each process can be either ready, running R (Running), or completing one of the three states of F (finished).

3) The ready process can only run one time slice after acquiring the CPU. Represented by the elapsed CPU time plus.

4) If the elapsed CPU time of the process has reached the desired run time after a time slice is run, the process is undone, and if the elapsed CPU time of the process after running a time slice has not reached the required run time, that is, the process needs to continue running, it should be inserted into the ready queue for the next dispatch.

5) Each time the schedule is scheduled, the program prints a run process, the PCB of each process in the ready queue for inspection.

3. Experimental principles and Core algorithms

The "Rotation method" has the simple rotation method and the multilevel feedback queue scheduling algorithm.

(1). The basic idea of the simple rotation method is:

All ready processes are queued as FCFS, always assigning the processor to the team's first process, with the same length of time slices for each process that consumes the CPU. If the running process has not finished using its time slice, send it back to the end of the ready queue and reassign the processor to the team's first process. Until all processes have finished running.

(2). The basic idea of the multilevel feedback queue scheduling algorithm is:

The ready queue is divided into N-level (N=3~5), each ready queue has different precedence and is assigned to different time slices: the higher the queue level, the lower the priority number, the longer the time slice, and the smaller the priority, the shorter the time slice.

The system is scheduled from the first level, when the first level is empty, the system turns to the second level queue, ... When the running process runs out of time slices, it discards the CPU and enters the next level queue if it is not completed.

When the process is first ready, it enters the first-level queue.

Experimental three-process scheduling simulation experiment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.