Hello, Thanks. You said > If you really meant 1 microsecond (as opposed to 1 millisecond)
Yes ,I mean it. In short: it's for a video-audio app; this app can be termed soft (or semi) real time; The terminology is not important at all. The fact is that there are scenarios when the timing is critical; I mean a packet that arrived at a certain time should not be sent immediately but after some sleep interval; this if for keeping a specified rate , which is important for a good quality. So sometimes a microsec sleep is needed, sometimes 5 or more. (Maybe it would have been better to phrase my question as sleeping in a resolution of microsecond instead of 1 microsec). You said: >to do a busy wait loop for the duration of the time required. may I ask ehat is the recommnded way to write a a busy wait loop? If I am not wrong there is no "noop" command in "C" ; is there a noop is asm to achieve this ? or simply a loop which just do dummy operation like incrementing some integer ? I tried using outb() from user space in the following way: According to chap. 9 of LDD3 (Communicating with HW),which generally talks about I/O ports,you can access I/O ports from user space in certain cases ; for that you need to call ioperm (or iopl) before. It says there : (page 242) "on the x86 the pause is achieved by performing an outb instruction to port 0x80, or by busy waiting." BTW , also "Linux I/O port programming mini-HOWTO" mentions this 0x80 port in this context. I had tried outb() on port 0x80 and it gave a different results on different platforms. Regarding gettimeofday() discussion which evolved from this thread: this is an interesting topic in itself and I am glad to see it here. I have a little remark regarding this (I may be wrong) Guy Keren said: " for the gory details - arch/XXX/kernel/time.c - do_gettimeofday()." I had looked at the sys call wrapper which calls do_gettimeofday(), which is in kernel/time.c (NOT under arch/... subtree) and I saw there a put_user() call , which means copying to user space if I am not wrong. Copying to user space seems to me a heavy operation (even if we only pass a little timeval struct). Regards, RG On 8/18/05, Gilad Ben-Yossef <[EMAIL PROTECTED]> wrote: > Rafi Gordon wrote: > > Hello, > > > > Is there a way to create a delay of 1 microsec in a user space > > applcation in 2.4 > > or 2.6 kernel? > > If you really meant 1 microsecond (as opposed to 1 millisecond) then the > answer is to do a busy wait loop for the duration of the time required. > Any system call will take more then 1 micro just to execute so they're > out of the question. > > Cheers, > Gilad > -- > Gilad Ben-Yossef <[EMAIL PROTECTED]> > Codefidence. A name you can trust(tm) > Web: http://codefidence.com | SIP: [EMAIL PROTECTED] > IL: +972.9.8650475 ext. 201 | Fax: +972.9.8850643 > US: +1.360.2275194 ext. 201 | Cel: +972.52.8260388 > > "I am Jack's Overwritten Stack Pointer" > -- Hackers Club, the movie > ================================================================To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]