You get a bonus - 1 coin for daily activity. Now you have 1 coin

Laboratory work No. 4. "MODEL OF MASS SERVICE"

Lecture





Objective: to investigate and study the use of list data structures in the simulation of queuing systems.


The task of the work: to master the skills of writing programs for the theory of mass service in the PASCAL programming language.


Operating procedure :

  • study the description of the laboratory work;

  • according to the task given by the teacher, to develop an algorithm for the program for solving the problem;

  • write a program in PASCAL;

  • debug the program;

  • to solve a task;

  • issue a report.



Brief theory



Task statement.

Let the servicing system consist of a finite number of servicing apparatuses. The system refers to the number of systems with the expectation. Each device can service only one requirement at a time. If at the moment of receipt of the next request there are free devices, then one of them immediately starts servicing, if there are no free devices, then the request waits for service. Naturally, if there are more requirements than service devices, then a queue is formed. The service time of a single request is a random variable subject to the exponential distribution law:

F (t) = 1-e - t

The flow of incoming requests is limited, that is, at the same time there can be no more than m requirements in the service system, where m is a finite number. This gives the right to assume that service requirements come from m serviced objects, which from time to time need maintenance. Let the probability that the service request be received at a given cycle is equal to P (A) and the probability that the demand from the queue goes to service be equal to P (B) (no more than one service request can be received at each cycle). The number of service vehicles is N. Suppose that the demand has waited for its turn and it has begun to be serviced. Service can last for no more than 3 cycles. Applications can be of two priorities:


First priority application:

This is a common application, it does not have any privileges. She can leave the system after a certain number of cycles T. When she arrives at the service system, the application of the first priority is placed at the end of the queue.


Second priority application:

This application differs only in that when it enters the service system it goes to the top of the queue, that is, as soon as the device is released, it arrives for service with a probability P (B).


The second priority application, like the first priority application, leaves the system after T cycles. Naturally, the appearance of second-priority applications is quite small (although this probability is given by the user and can be any). Now about maintenance: The number of cycles during which one or another application will be serviced is chosen randomly (this value in this task should not be greater than 3). If the application has served the required number of cycles, then it leaves the system. If the application is in the queue with more than T cycles, then it leaves the system with some probability.

Algorithm



The most rational implementation of queues in the form of list data structures. This task, when implemented on a computer, gives great skills when working with list structures and when writing an algorithm for a program one should use standard procedures, such as attaching an element to the beginning and end of the list, deleting an arbitrary element from the list. These procedures are as follows:

The procedure for adding an item to the top of the list.


p = getnode Node (p) - the element pointed to

info (p) = d pointer P

ptr (p) = lst info (ptr (p)) - information field of the following

lst = b list item

The removal procedure from the top of the list.


p = lst

x = info (p)

lst = ptr (p)

freenode (p) - makes a free node with a pointer

The procedure for adding an item to the list.


p = getnode q - pasted

info (p) = x

ptr (q) = ptr (p)

ptr (p) = q

Uninstall procedure


q = ptr (p) q - removable

ptr (p) = ptr (q)

x = info (p)

freenode (q)

Tasks



A common task for all.

Suppose there is a service system of n service devices. The work of this system is divided into cycles. During one cycle, one application can be placed in the queue and one application can start servicing, (of course, if the device is free). The probability of an application to enter the service P (A), the probability of serving an application P (B), the probability of an application leaving the queue after T cycles P (C). After each L cycles, to give information about the queue length and the number of cycles during which the service device was idle. Even options implement a service system with an unlimited queue, odd options with a final queue (i.e., if there are K requests in the queue, then the next request is denied service).

Options:

1) L = 50, after the end of the system to give information about how many applications left the system without service.

2) L = 55, after the end of the system to give information how many applications were served more than 2 cycles.

3) L = 100, after the end of the system to give information, how many clock cycles the queue was empty.

4) L = 75, after the end of the system to give information on how many applications were serviced one cycle.

5) L = 25, after the end of the system to give information on how many applications of the first priority have started the service.

6) L = 40, after the end of the system to give information about the average increment of the queue.

7) L = 80, after the end of the system to give information about how many applications were served 2 cycles.

8) L = 100, after the end of the system to give information, applications served.

9) L = 70, after the end of the system to give information on which tact was the longest queue.

10) L = 50, after the end of the system, calculate the practical probability of machine downtime according to the formula s / n, where s is the number of machine idle cycles, n is the total number of cycles.

11) L = 65, after the end of the system to give information on how many second-priority applications were received for servicing.

12) L = 30, after the end of the system to give information about how many applications were served 2 or 3 cycles.


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Structures and data processing algorithms.

Terms: Structures and data processing algorithms.