LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-08-2009, 08:20 AM   #1
bizoo
LQ Newbie
 
Registered: Jul 2009
Posts: 17

Rep: Reputation: 0
shared timers between kernelspace and userspace


Hi,
I want to create a timer which i can use in both kernel and user space. I tried looking at different timer options such as timer_create or timerfd_create but according to my limited knowledge they look limited to one space (kernel/user) and not used in both. This way i will be able to do some measurements regarding duration of system calls etc

Any hints or pointers will be appreciated


cheers!
 
Old 07-09-2009, 11:03 AM   #2
nanoo
LQ Newbie
 
Registered: Jul 2009
Posts: 19

Rep: Reputation: 1
Didnt get it. Processor can be only in one of the four states: user space, system call, soft interrupt, hard interrupt. As I understand the process timer event wake up some soft interrupt and your user space program will know about it only after soft intr and then syscall return. All other time it will be suspended.
Why don't you use gettimeofday(2) for measurements time in user space?
 
Old 07-09-2009, 12:08 PM   #3
bizoo
LQ Newbie
 
Registered: Jul 2009
Posts: 17

Original Poster
Rep: Reputation: 0
hmm getimeofday or clock_getime serves the purpose too, but actually my goal is to synchronise two clocks (on two differenc PCs)and for that matter i dont want to change the system clock using set_clocktime as several processes rely on system clock.



So my idea was to make some timer of my own which receives a packet with sender timestamp, put its own timestamp in the kernel and the actual synchronization be done in user space. For that to happen, it should be one timer for kernel and user space.
i hope i have elaborated on my problem now

thanks in advance for suggestions!
 
Old 07-10-2009, 03:33 AM   #4
nanoo
LQ Newbie
 
Registered: Jul 2009
Posts: 19

Rep: Reputation: 1
The solution strongly depend on precision of time measurement. What is matter for your task? milliseconds, mikro-, nano-?
For milli I would use this
http://www.linuxhomenetworking.com/w...The_NTP_Server
Set server on one computer and client on other one. Maybe this will work for mikro too.
Cannot suggest anything for nano.
 
Old 07-10-2009, 05:34 AM   #5
bizoo
LQ Newbie
 
Registered: Jul 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Yea i know about NTP,
but i am thinking of doing things on my own rather than using NTP or any other synch protocol
and then as the hrtimer in linux have nanosec resolution i can possibly achieve some higher accuracy.

thats my point and thats why i want a timer accessible in both kernel and userspace!
 
  


Reply



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
What do people think of having virtual machines running in the kernelspace? wilsonsamm Linux - General 4 10-16-2008 02:17 PM
making Common .h file for userspace and kernelspace devkpict Linux - Kernel 0 02-04-2008 01:54 AM
Trying cdemu userspace Q.. Linux - Software 6 11-30-2007 02:37 PM
about timers eshwar_ind Programming 1 12-27-2004 09:23 AM
Slackware AMD64 userspace joel112 Slackware 2 10-03-2004 11:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:37 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration