Dining philosophers: Difference between revisions
Content added Content deleted
MaiconSoft (talk | contribs) (Added Delphi example) |
|||
Line 3,442: | Line 3,442: | ||
S - Starting time for the new activity |
S - Starting time for the new activity |
||
Q - Queue |
Q - Queue |
||
U - Upper bound for the number of philosophers |
U - Upper bound for the number of philosophers who can eat simultaneously |
||
P - Active philosopher |
P - Active philosopher |
||
E - Elapsed Time (only for information purposes) |
E - Elapsed Time (only for information purposes) |
||
Line 3,460: | Line 3,460: | ||
(N Q)`((;: o N) j (''c)) h NB. Boxing the names, empty queue |
(N Q)`((;: o N) j (''c)) h NB. Boxing the names, empty queue |
||
(A T)`((0:items j thinktime&>) o N) h NB. All start thinking |
(A T)`((0:items j thinktime&>) o N) h NB. All start thinking |
||
(E U)`(0 ; <. o (2 %~ # o N)) h NB. |
(E U)`(0 ; <. o (2 %~ # o N)) h NB. Elapsed time 0, Upper bound |
||
[ echo o (time , 'All of them start thinking.'c) |
[ echo o (time , 'All of them start thinking.'c) |
||
) |
) |