LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 11-29-2006, 05:24 PM   #1
d71
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Rep: Reputation: 0
Question how is select()/poll() effected by clock setting?


I have observed behavior that MAY be explained by select() (or poll()) used with a timeout value returning when the system clock is changed by ntpd (or maybe the date utility).

I call select() with a timeout and when the system clock is updated (ntpd started) it appears that the select returns as if it timed out.

Anyone know whether is the really the behavior of select()?
I am using a 2.4 Linux kernel.

d71
 
Old 12-01-2006, 03:21 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,537

Rep: Reputation: 149Reputation: 149
I can't find such behaviour in the code. Do you have a chance to see what's the struct timeval passed to select value after return? In Linux it returns the time left to the actual timeout.
 
Old 12-01-2006, 03:37 PM   #3
d71
LQ Newbie
 
Registered: Nov 2006
Posts: 3

Original Poster
Rep: Reputation: 0
No, I have not done any further experimentation yet.

I too looked through kernel code and found that it appears that possibly all waiting processes/tasks are awakened when the system time is modified. I say possibly because there are some conditions on awakening the processes/tasks and I don't know whether they apply.

Also, even if the process is awakened, I don't know what the behavior of the process is after being awakened, i.e., does the system call in which it is waiting return immediately or might it go back to waiting.

In this case the changing of the clock a (I think) large time forward may cause the time limit to appear to have been exceeded, i.e. timed out. However, we appear to see this expiration when the clock is modified by NTP even when the modification is far less than the timeout value.

The return value in the struct timeval might shed some light on that.

Thanks!
 
Old 12-02-2006, 03:00 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,537

Rep: Reputation: 149Reputation: 149
Large change of time value is another story (through I have not managed to wake up my select() when I made such an experiment, but it's 2.6), but with short changes there's no reason to wake them.
 
  


Reply

Tags
poll, select


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
poll/select in tty driver metso777 Linux - Kernel 0 11-13-2006 09:57 AM
select/poll and Signal Safety nopcoder Programming 9 01-30-2006 07:05 PM
setting the clock dasy2k1 Linux - Newbie 6 10-08-2005 02:19 PM
How much is perf. effected by Celeron ttwiv Linux - Hardware 6 04-20-2004 04:22 AM
Setting Clock ArthurDent Linux - Newbie 2 03-27-2004 07:09 AM


All times are GMT -5. The time now is 08:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration