Re: kernel-threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 18, 2004 at 23:16:55 -0700, prasanna wakhare wrote:
> hi,
> yes, i can't do IO,but never wait,
> but instead i loop until upto i wont get packet, this
> is as good as busy waiting is this a wrong way i'm
> thinking?,or

And that's exactly your problem. You MUST NOT BUSY WAIT. If you are
doing IO, you must either do it blocking, or select(2) (or poll(2)) for
it. That's true both in user-space and kernel-space, but while in
user-space it only slows the computer down, in kernel-space it locks up.

> second is to wait and put the thread to sleep,
> even a 1 jiffies sleep is working,
> this means delay  is when i get packet and when i
> process it is 1ms,and worst 10ms in 2.4,but what for
> some reason it has to immidiatly process the data as
> soon as packet arrives.

Ever heared about select(2) or poll(2)?

And why can't you just let it block until the packet arrives. When it
arrives, it will be immediately returned for processing.

> i find several ways in google,from checking O_NONBLOCK
> flag etc. but i wont understood those as thise are
> just a code snippets and no explaination is given
> thanks

That's the great thing about Linux kernel -- you can read the source ;-).

Have you ever read the manual pages of open, read and fcntl? They have
enough information on O_NONBLOCK. The rest just logicaly follows.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux