A few easy questions

This is a discussion on A few easy questions within the C Programming forums, part of the General Programming Boards category; 1. When talking about the time a process has used up, there seems to be a term called jiffies for ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    87

    Talking A few easy questions

    1. When talking about the time a process has used up, there seems to be a term called jiffies for example. "stime: The number of jiffies that this process has been sheduled in kernel mode". What is a jiffie??

    2. How do I obtain the correct format from these jiffies, i've tried using strftime but this seems to give the incorrect format claiming that the process has been running for over an hour rather than less than a millisecond in some cases.

    3. How do i get a consistent format when using printf, for example say I had three parameters for each process, the process id, the terminal being used and the name of the process. Each time these are printed a new line is inserted and the same happens for the next process found. Problem being is say the user id in one case was 3 digits long and in the second case it was only 1 digit long, this would in turn effect where the tty was being printed i.e. the process with one digit, the name of the tty would be printed further to the left than that of the one with a 3 digit process id. I've tried using tab characters in the printf but this causes the same problem. How do I maintain a consistent format for all of the processes.
    PuterPaul.co.uk - Portfolio site

  2. #2
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633

    Re: A few easy questions

    Originally posted by pdstatha
    1. When talking about the time a process has used up, there seems to be a term called jiffies for example. "stime: The number of jiffies that this process has been sheduled in kernel mode". What is a jiffie??
    FOLDOC definition of a Jiffy.
    Jason Deckard

  3. #3
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633

    Re: A few easy questions

    Originally posted by pdstatha
    3. How do i get a consistent format when using printf, for example say I had three parameters for each process, the process id, the terminal being used and the name of the process. Each time these are printed a new line is inserted and the same happens for the next process found. Problem being is say the user id in one case was 3 digits long and in the second case it was only 1 digit long, this would in turn effect where the tty was being printed i.e. the process with one digit, the name of the tty would be printed further to the left than that of the one with a 3 digit process id. I've tried using tab characters in the printf but this causes the same problem. How do I maintain a consistent format for all of the processes.
    Er, and one more link.
    Jason Deckard

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    4
    1. A hardware timer is programmed to periodically inerrupt the CPU (called timer interrupt).Time elapsed between two successive interrupts is called a jiffie.Which is 10ms in case of Linux system.
    2. In case you are using a Linux system ,You can use time command to find time the processed as used.

    time <name_of_program>

    gives the time spent by the program in user and kernel modes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. Replies: 1
    Last Post: 06-17-2005, 07:29 AM
  3. Questions on Speed of Execution
    By wavering in forum C Programming
    Replies: 22
    Last Post: 01-20-2002, 01:04 PM
  4. questions about new and delete
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2001, 01:48 PM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21