Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
That works!!!!Have a silly doubt regarding my application,plz excuse. I actually want to transfer the data from the upper layer to lower layer once this timer starts and before it expires. And then i need to call the timer function again to restart the timer once it expires and again check for data and transfer it.This needs to be repeted. Will it work if I integrate this code with the lower and upper layers? Thanx in advance again.
I don't understand what u r trying to do, (who is the sender, the receiver, anh the information flow), but if u want to receive data from the kernel, your user space app could make use of rtnetlink socket instead of waiting until a timer ends.
If u explain your case in more detail, I'll try to help u.
Okie,I will explain you in detail. I have a timer module,scheduler module,upper layers(RRC,RLC),MUX,DEMUX module and finally the lower layer(PHY layer). I need a timer resolution of 1 ms which has to be given to the scheduler and that signal is passed to upper layers to tell them to send the data through MUX/DEMUX module to PHY layer. All this happens within the timer expires. Once it expires,the timer function should be called again to start the timer with 1 ms resolution and this continues. This is the application i need to develop. So,Can I use the above CODE for the 1 ms resolution and starting the timer again? Thanks in advance.
Last edited by sandeepvignesh; 06-10-2009 at 01:14 AM.
Reason: neede to include something.
I have one more doubt regarding endianess. My system here is little endian and the board I am communicating with is big endian. Hence the data received by the board is not same as what I am sending. I have heard about htons and htonl,are they used only for IP address conversion or even for data? I just need to make sure that data should be matched both the sides,so can you please help me out!!!!Thanks in advance.......
Well. For the timer what u really need is just a timer that can initiate a signal or a thread so u can handle whatever u want on that time. I have created a timer class. u can use it. It's a bit flexible. u can handle the timer by either a thread or a signal. I have only used it with signals tho. It's not well documented and am sorry about that. I uploaded it quickly today to post it for you. Any questions pls ask. Here is the link.
btw if you want to learn more about timers and signals in linux, There is a book that is well explaining both subjects. U will have to read only two or chapters. Won't take much time from you. The book name is Linux system programming. You can find the pdf if you do some googling.
I have no clue about big and small endian programming. May be someone else can help.
The class is written in c++ but it should be working as c as well. It's using some system calls. If u r looking for simpler way u can still use select passing it 3 NULL parameters like this,
retval = select(0, NULL, NULL, NULL, &tv);
This will simply wait for the time set in tv. It won't return until it expires. unless an error happened. The only difference between this and what shibeaux posted is that it won't return if the stdin got any input.
And btw the timer class provide nanoseconds resolution. You only have to pick what's best for you. When I was looking in timers, I had to implement that class cause I wasn't looking for just sleeping. I was looking for something like an API timers. That means it doesn't stop my program till it ends. I wanted to keep my program flowing till the timer expires and go do specific method. *That's the big difference between select in this case and the timer class*