Project translated automatically.
Log in
or
register,
to view the original
You need to create a program on s++, or java has operating memory for 1 000 000 (million) free elements.In the operating memory comes a task that occupies 1 element of the operating memory.That is, after receiving 1 task, the operating memory became 999 999 free.The tasks are performed in a row of 3-7 minutes.Time should be generated randomly from 3 to 7. the task becomes in turn to the first processor.If 1 processor is free, the task is processed by it for 4-6 minutes.Time is set randomly from 4 to 6 after the task is completed by the first processor, the task is increased by 1 and returned to the operating memory.It occupies two elements of memory.The task goes to 2 processors.If the processor is free, the task is processed by them for 2-3 minutes for each element.The time is randomly assigned from 2 to 3 after the task is performed by the second processor, the task is increased by 1 and returned to the operating memory.It occupies three elements of memory.The task is to turn to 3 processors.If the processor is free, the task is processed by 1.1-1.9 minutes for each element.The time is assigned randomly from 1.1 to 1.9. after the task is performed by the third processor, the task leaves the system and releases the memory.Three elements are returned to the system.The tasks will come every 3-7 minutes.If the processor is free, it begins to process the task.If it is busy, the task is waiting in a row, thus taking memory.The line can be large, there are no limitations in the task.The processor can only process one task at a time.Example: in order to 1 processor 3 tasks, to 2 processor 1 tasks, to 3 processor 1 tasks.All processors work.Operating memory occupation: 1*3 (work in order to 1 processor) + 1(work in 1 processor) + 1*2 (work in 2 processor (work occupies 2 memory elements) + 2 (work in 2 processor) + 1*3 (work in 3 processor (work occupies 3 memory elements) + 3 (work in 3 processor) = 14 memory elements occupies tasks.Free memory 1000000 - 14 = 999986 time is conditional and does not depend on the time of the computer.You need to find how much average memory is occupied and extract the value on the screen.How much time the program will work will the user ask.