Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Quiz about synchronization of 3 process

I'm trying to solve following quiz:

The confluence of 3 two-way roads is managed by a French-style roundabout so:
1. the right of way is for those who are already traveling at the roundabout;
2. the direction of travel is counterclockwise.

Each sector i of the roundabout (section between two consecutive accesses i and i+1 mod3 ) can contain a maximum MAX_i number of cars.
Represent the the behavior of cars when crossing the roundabout.
Each car is represented by by a process that can recall three functions:
• INPUT(i): used to access from outside to the roundabout from access i;
• NEXT(i): used to move from sector i of the roundabout to the next one;
• EXIT(i): used to exit the roundabout at the end of sector i.

For simplicity, set MAX_i = 1 for each sector and simplify the priority rule. for vehicles coming from outside, establishing that a car can enter the roundabout access only if the sector is not currently occupied and the sector is not previous. The issue of deadlock is being discussed.
This is my solution, what do you think?
```class Example {
semaphore mutex = 1;
semaphore sectors[3] = {0, 0, 0};
boolean isFree = true;

public void input (int i) {
P(mutex);
while (sectors[i]==0) {
//wait for the sector
}
isFree = true;
P(sectors[i]);
V(mutex);
}

public void next (int i) {
P(mutex);
while (sectors[i+1]==0) {
//wait for the next sector
}
isFree = true;
V(mutex);
}

public void exit (int i) {
P(mutex); //only 1 process can enter in the rondabout
if (isFree) { //check the rondabout
isFree = false;
V(sectors[i]);
}
V(mutex);
}```
I think that the deadlock can be caused only if all the process try to access to the same sector, right?

3. ## Re: Quiz about synchronization of 3 process

The ios environment is secure, and developers should consider both their clients and their own personal views in their designs https://mlsdev.com/blog/ehr-development. A style guide explains how the app will function and streamlines the user experience. While sketchpad apps can be used without a mobile connection, all iOS applications require a mobile connection to update and install. The final steps of ios development are mockups and a prototype. These products are useful in assessing the design functionality and evaluating the feasibility of a mobile application.