Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Blocking process

  • 27-02-2007 1:15pm
    #1
    Registered Users, Registered Users 2 Posts: 590 ✭✭✭


    Hey,

    I'm not sure if this should be in the programming forum but here goes anyway.

    I have a perl program that implements a TCP server. It is a blocking type connection. When the accept function is called does that process then get any time on the processor while its waiting for the client connection? Or is it put into the blocking queue until the client makes contact? And if it is in the blocking queue then does it get absolutly no processor time?


Comments

  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    bman wrote:
    Hey,

    I'm not sure if this should be in the programming forum but here goes anyway.

    I have a perl program that implements a TCP server. It is a blocking type connection. When the accept function is called does that process then get any time on the processor while its waiting for the client connection? Or is it put into the blocking queue until the client makes contact? And if it is in the blocking queue then does it get absolutly no processor time?

    Hi bman. :)

    It depends on the other processes running at the time and what type of scheduler you are using in your Kernel. If you are doing some heavy disk access then it won't get much of a time slice.

    Sleeping is handled via wait queues. A wait queue is a simple list of processes waiting for an event to occur. Wait queues are represented in the kernel by wake_queue_head_t. Processes put themselves on a wait queue and mark themselves not runnable. When the event associated with the wait queue occurs, the processes on the queue are awakened.

    I imagine it sits there waiting for a connection, and until that event occurs it does nothing. This would be the best way for it to be implemented, afterall it has nothing to process when it is waiting for a connection.


  • Registered Users, Registered Users 2 Posts: 590 ✭✭✭bman


    Thanks for the reply.

    Thats what I wanted to hear :D . This task could be sitting there for ages without any client trying to connect so I didn't want it taking up processor time due to this system using a slow processor and running time critical tasks. I thought the way you said would be how it was implemented but I wanted a second opinon.


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    bman wrote:
    Thanks for the reply.

    Thats what I wanted to hear :D . This task could be sitting there for ages without any client trying to connect so I didn't want it taking up processor time due to this system using a slow processor and running time critical tasks. I thought the way you said would be how it was implemented but I wanted a second opinon.

    No problem mate. You would definitely want to test this out though, seeing as it is running on a critical system. The Kernel it is using is also vital. I'm talking about the 2.6 Linux Kernel when I gave my description. Also, how it is coded and how perl implements this is also vital.


Advertisement