Operating Systems monitors

Kapalı İlan edilme: 4 yıl önce Teslim sırasında ödenir
Kapalı Teslim sırasında ödenir

High up on Everest, Sherpaas have installed two ropes to assist the climbers in crossing a deep glacier

crevasse.

The rope can hold only a maximum of three climbers at any one time, and they all have to travel in the same

direction. Obviously, you can have two groups of climbers going in opposite directions by using one rope

each.

Create a monitor based solution to this problem. Your program should support an arbitrary number of

climbers/threads, that will be randomly assigned to one or the other side of the crevasse, and they will try to

cross after waiting for a random amount of time. E.g.:

$ ./crossing 25

should create 25 threads.

Your design should follow the “critical section outside of the monitor” approach. Each climber should ask

the monitor for permission to cross in one of the two directions (east-to-west or west-to-east). The monitor

should return the rope id to use for the crossing, if one is available in that direction and it has capacity to

spare. An empty rope could be employed to carry people in any direction.

The output of your program should be similar to this:

Climber 1 is waiting to cross.

Climber 2 is waiting to cross.

Climber 1 is assigned rope 1.

Climber 1 is crossing from east to west using rope 1.

Climber 2 is assigned rope 2.

Climber 2 is crossing from west to east using rope 2.

Climber 2 finished crossing.

Climber 1 finished crossing.

C Programlama C++ Programlama

Proje NO: #24750719

Proje hakkında

2 teklif Uzak proje Aktif 4 yıl önce

Bu iş için 2 freelancer ortalamada $33 teklif veriyor

aknikam

Hello, I am expert in os programming specially linux. I have in depth knowledge of linux kernel from memory subsystem(virtual memory), file subsystem(VFS[virtual file system], ext4) , process subsystem(interrupt, sign Daha Fazla

$35 USD in 2 gün içinde
(0 Değerlendirme)
0.0