| |

VerySource

 Forgot password?
 Register
Search
View: 707|Reply: 1

A pv operation problem

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-29 17:20:01
| Show all posts |Read mode
There are n + 1 processes A1, A2, .... An and B, A1 ..... An each continuously sends messages to B through the same buffer, and B keeps fetching messages, it must fetch every message sent. The buffer was empty at the beginning, and the trial PV operation was implemented correctly.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-12 09:30:01
| Show all posts
The semaphore of a1 ~ An is sa = 1
The semaphore of b is sb = 0
Process a1 ~ An
while (1) {p (sa); v (sb)}
Process b
while (1) {p (sb); v (sa)}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list