![]() |
Pages (3): [1] 2 3 » Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Sistemi operativi e distribuiti (http://www.dsy.it/forum/forumdisplay.php?forumid=270)
-- [PROGETTO] tutti al mare (http://www.dsy.it/forum/showthread.php?threadid=26739)
[PROGETTO] tutti al mare
qualcuna ha la minima idea di come simulare una coda fifo con i thread?????
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
Credo si intenda di fare una notify anzichè un notifyall, in questo modo risvegli solo il primo thread nella coda....
si ma con il notify svegli un thread a caso e non il primo della coda......credo......qualcuno mi corregga se sbaglio........
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
Hai ragione...
proviamo a cercare...
spremiamo le miningi.......
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
non conosco bene le specifiche, ma l'utilizzo di una lista potrebbe risolvere qualche problema
http://java.sun.com/j2se/1.3/docs/a...stractList.html
a questo punto ogni thread creato si può mettere in coda e venire così posizionato alla fine della lista.
quando un posto si libera ci sarà un notifyall e tutti i thread controlleranno la loro posizione (in lista) , il primo usicrà dalla lista e così via
__________________
The only way to discover the limits of the possible is to go beyond them into the impossible.
Arthur C. Clarke.
in giro leggo che la jvm schedula automaticamente secondo l'algoritmo FIFO i thread con ugual priorità.......vedrò di approfondire
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
quindi dopo il notifyall del thread che libera un posto, ogni thread si posiziona nel posto più vicino all'uscita (del ready queue) e solo quello che si trova in posizione 0 non si autoferma ma prosegue con l'esecuzione.........ho capito bene?
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
anche una hashtable potrebbe andare....
Ho detto una cazzata, meglio questo:
http://www.dia.uniroma3.it/~cabibbo.../ArrayList.html
ma si possono usare librerie non standard?
cmq ogni lista va bene, i metodi bene o male son sempre quelli
__________________
The only way to discover the limits of the possible is to go beyond them into the impossible.
Arthur C. Clarke.
io ho imbastito un sistema senza coda......quindi il notify svegli un solo thread e con i tempi che ci sono nelle specifiche non riesco ad arrivare nemmeno nella situazione di coda......in sostanza se arrivano bagnanti tra 200 e 1000 millisecondi e se ne vanno dopo un periodo tra 500 e 2000 millisecondi non mi si riempiono mai tutti gli ombrelloni......a voi succede così?
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
Si riempiono solo moooooooooolto in là, se fai proseguire il programma ad oltranza, prova a metter solo 3 ombrelloni e vedi
ho provato a moltiplicare x 10 i tempi di permanenza sotto l'ombrellone e la coda effettivamente si riempie.......ma con le specifiche non si riempirà mai.......
__________________
we are just two lost souls swimming in a fish bowl year after year....running over the same old ground....what have we found.......
Quello si, se allunghi la permanenza è come rimini ^^
All times are GMT. The time now is 11:58. | Pages (3): [1] 2 3 » Show all 43 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.