Distributed calculations of Java management processes,flow (night)
Theme: Processes and Streams (Nights)Task: Set up a program (process) that runs two background flows (night) in parallel.Use the synchronization of flows on a joint resource.Description of the program:
When the program starts with the "Start" button, two Tthread1 and TThread2 streams are simultaneously launched, trying to set the "running" in their position (1-in position 10, 2-in position 90)
Streams can change priorities, and depending on the priority, the advantage is given either to one or another stream.
When the program is completed, the flows are destroyed.
b) Theme: Management of processes, flows (nights) in the critical section using the blocking variable (the easiest semaphor)
To use the task program 1
The program will make the following changes:
Introduction of the global variable for the semaphore type integer
Place the PUSC 1 and PUSC 2 buttons for the start of the first and second streams (night), before this set the seamfor in the position "sized"
Place the STOP 1 and STOP 2 buttons to stop the first and second flows (night), set the seamfor in the "free" position.
The PUSK 1 button sets the lowest priority for the first stream.
The PUSK 2 button sets the highest priority for the second stream.
Description of the program
Streams are running consistently.If one of the streams works, the second is not possible to launch because the critical section is busy and it displays the message "Covered by the stream"
The Stop button releases the critical section and destroys the current flow.The PUSC button starts the flow and blocks the STOP button of another flow.
The correct work of the program is as follows: The PUSC 1 button sets the runner in position 10, there it is and remains until we press the PUSC 2 button that sets it in the 90 state.
Attention to!Semaphor (blocking variable) is a global variable, available to both streams, therefore they work in one address space (the process).If the Semaphor regulated the interaction of not flows, but processes, then it must be global in relation to them and thus be in the address space of the operating system that manages processes.
Client's review of cooperation with Oleksandr Denisov
Distributed calculations of Java management processes,flow (night)Everything is great, the work is done quality and timely.
![]()
Freelancer's review of cooperation with client
Distributed calculations of Java management processes,flow (night)Everything is great!
A quick response, a quick response.
The agreement went great!
-
51 3 0 Good day !
Is it all the task that is given? Is there a more accurate description of what to do?
Maybe that’s what you need?
The animation here works incorrectly, but I’ll fix if that’s.
HTTPS://youtu.be/d1H6-RiWeug
Upd
So, maybe closer to the truth.
HTTPS://youtu.be/mGQwYu4SoIA
Current freelance projects in the category Java
Development of simple 2D games (Snake, Galaxy, etc.) for Google Play MarketHello! I am looking for a developer (or a beginner with a good foundation) who can create several simple classic 2D games for the Android mobile platform with subsequent publication in the Play Market.To start, one or two games need to be developed. Examples of settings and… Java, Gaming Apps ∙ 13 hours 38 minutes back ∙ 12 proposals |
Application developmentI wish to create a mobile application for communication, the app should have audio and video calls, group chat creation, the ability to sync with phone contacts, account settings: email binding, 2FA, phone number, the ability to customize app notifications, change the app… Java, Python ∙ 5 days 7 hours back ∙ 39 proposals |