Doubts about timers in linux kernel


 
Thread Tools Search this Thread
Top Forums Programming Doubts about timers in linux kernel
# 1  
Old 02-22-2009
Doubts about timers in linux kernel

Hi ,


I am trying to learn timers in linux kernel. I am trying to write a program where I can configure a timer to tick in every 5 seconds and a function should thus exicute in every five seconds. I tried one program with the help of linux/timer.h headerfile but I couldnt get the delay right and my function exicutes only once.That is my timer acts like a single shot timer. How can I make the timer multi slot (not single slot , that is what I am trying to say), Plus How can I calculate the time delay in linux kernel. What is jiffies infact. What is the value of 1 jiffy in seconds . Hoping for help

Jayanth. S
# 2  
Old 02-23-2009
(moved to C programming forum).

Please post your existing code.
# 3  
Old 02-23-2009
A good place to start would be the alarm function (man alarm). alarm sends a signal to the process every so many seconds so you need to write a handler to trap that signal and call another function from within it. And post your code also.
# 4  
Old 02-24-2009
Thanks for the reply. But I want a timer in kernel space. We cannot use alarm functions in kernel space. That is why I posted this in linux forum. I want to user add_timer() setup_timer functions in linux/timer.h. I tried in vain . I could only create a single shot alarm .How can I take a multislot alarm in kernel.
# 5  
Old 02-24-2009
Quote:
Originally Posted by iamjayanth
Thanks for the reply. But I want a timer in kernel space. We cannot use alarm functions in kernel space. That is why I posted this in linux forum. I want to user add_timer() setup_timer functions in linux/timer.h. I tried in vain . I could only create a single shot alarm .How can I take a multislot alarm in kernel.
No that won't work as I missed the part about kernel space timer...the alarm/pause calls will work only in the context of a user process.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linux kernel modules makefiles doubts

This query is regarding the makefiles of linux kernel modules. I saw at some sites on net it is suggesting to include the following path: KERNEL_SOURCE := /usr/src/linux... while at some places it is askibg to include /lib/modules path: KERNEL_SOURCE := /lib/modules/2.6.27-7-generic/build... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

2. Shell Programming and Scripting

A Question Regarding Timers and Output

Hi there. I am fairly new to scripting in BASH so please forgive my clumsy syntax and analogy as I try to explain what I am trying to accomplish. I have a list of mundane functions that I currently call from a script file. What I wish to do is to accurately record into a log file the times that... (17 Replies)
Discussion started by: Tenuous
17 Replies

3. Programming

pthread_mutex_timedlock and Timers option

in its man-page pthread_mutex_timedlock documents that the absolute timeout parameter should be based on the CLOCK_REALTIME clock or in the system clock. All this depending on whether the 'Timers option' is supported or not. What do they mean by 'Timers option'? How could I tell for sure what... (8 Replies)
Discussion started by: ramestica
8 Replies

4. Shell Programming and Scripting

Few doubts on Linux scripting

1) I have to create 3 scripts which create different output files. Script one creates datafiles, script2 creates control files and script3 creates flg files. The business wants the same timestamp to be attached to all the files created by these scripts. Script1- Create data files - Data files... (2 Replies)
Discussion started by: Maya_Pillai
2 Replies

5. Red Hat

qmail configuration in redhat linux - doubts

hi, How to Install & configure the qmail in redhat linux? and also how to get the free qmail package? I know the sendmail configuration in redhat linux. What is the features of qmail compared with sendmail? Regards, Jones (3 Replies)
Discussion started by: jones_linux
3 Replies

6. Programming

Doubts About C Compiler In Unix/linux

As all of you know whenever a program "say a.c" is complied in linux using the gcc or the cc compiler..it shows the list of errors ( if the program contains any).. i want to modify the compier script so as to list the no of errors only and not the description about the error..like" parse error " ... (1 Reply)
Discussion started by: vrs
1 Replies

7. Programming

unix and timers

Hello there.. I need to know when i start indipendant timers how can i recognize which of the active timers have made timeout alarm. The number of started timers depends on the running app I'd appreciate your help Thanks in advance (0 Replies)
Discussion started by: nightcat
0 Replies
Login or Register to Ask a Question