lug-bg: Spiasht proces
- Subject: lug-bg: Spiasht proces
- From: sn@xxxxxxxxx (Svetoslav Nikolov)
- Date: Thu, 10 Aug 2000 08:53:06 +0200
Zdraveite,
Imam slednia "problem". Opitvam se da napravia malak server za edna platka
(Blacktip PCI - http://www.bittware.com za podrobnosti). Platkata e
"busmaster" na PCI shinata i prehvurlia chrez DMA danni v pametta na
komputara. Kato dannite se prehvurliat vdiga interrupt, koito triabva da
sabudi servera - da go narechem "SRV". SRV e programa izpulniashta se
v "user space". Zasega sam haknal problema po slednia nachin:
1) Draivera registrira prekusvaneto.
2) Programata pravi thread: "pthread_create". Tozi "thread" vika draivera
koito go prispiva s : "interruptible_sleep_on".
3) Programata si produljava s rabotata
4) Kato doide prekusvane draivera vika "wake_up_interruptible". Threada se
sabujda i vdiga neobhodimite flagove.
Tazi shema raboti OK. Problemat e che ako v tochka 3) programata vikne
sleep(24*3600), "thread"-at ne se sabujda. Znam che programata reagira
na signali po vreme na "sleep", poneje taka sam reailiziral vhod/izhod ot
klaviaturata
Vmesto da se varti cikal ot tipa na
volatile int message_received, dma_received,....
...
while(1){
while(!(message_received || dma_recevied || kbd_hit || ..))
if (dma_received) process_dma();
if (message_receiver) process_message();
....
}
bi bilo hubavo da ima
while(1){
sleep(24 chasa) ...
if (dma_receiver) process_dma(); ...
if (message_receiver) process_message(); ...
...
}
zashtoto na komputera rabotiat i drugi programi, koito se nujdaiat ot
procesora.
Ako niakoi znae dali ima nachin
1) Draivera da izprati "signal" na saotvetnata programa
2) Nishkata koiato e "prispata" s "sleep_on_interruptible" da se sabudi
nezavisimo ot komandata "sleep".'
shte sam mnogo blagodaren.
Svetoslav
--
=====================================================
Svetoslav Nikolov
Dept. of Information Technology
Build. 344, room 209
Technical University of Denmark
DK-2800 Lyngby, Denmark
E-mail: sn@xxxxxxxxx
Phone : +45 45 25 37 05
Fax : +45 45 88 01 17
URL : http://www.it.dtu.dk/~sn
=====================================================
==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
Otpiswaneto RABOTI !!! : Majordomo@xxxxxxxxxxxxxxxxxx UNSUBSCRIBE LUG-BG
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|