Re: HPUX sleep effect on CPU time slize and thread priority



On Nov 17, 5:28 am, Rick Jones <rick.jon...@xxxxxx> wrote:
xbokZ...@xxxxxxxxx wrote:
I have several client application that do same processing. The
application is spawn by another application called server. One of
them is recently patched tosleepjust between being fork and spawn.
So the way it is done is in server application, fork to client
threadand serverthread.

A wording nit - fork() creats a child _process_ not athread- calling
it athreadimplies (at least to some) something like POSIX threads.

----------------------------
//server code
pid_t pId = fork();
//Lots of code
if (pId == 0)
{
//The way I understood it, this is the clientthread
usleep(500000L); //Sleep500 milisecond

Out of curiousity, why thesleep?

rick jones
--
denial, anger, bargaining, depression, acceptance, rebirth...
where do you want to be today?
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

OK my bad! I really thought client process equal to a new thread.

The sleep function is to delay it a few hundred millisecond so that
some code in the else (parent process) part is executed first. I guess
that hold true if child process is something like a thread.

I got a feeling that I'm not understanding how fork work by assuming
that it create another thread. Please advise me on this.

I'm still curios on the answer to first post question.

Best regards!

.



Relevant Pages

  • Re: A Simple Unix Forking Server and Client
    ... The server program should be able to handle ... | I have wriiten a server progam and a client program which reads one ... The key thing is that after a fork() you have to copies of your program, ... and in the other copy forkreturned the pid of the child. ...
    (comp.unix.programmer)
  • Re: rsync for OpenVMS?
    ... Overcome the fork() issue. ... On the client, it does two things. ... One is it spawns it self, ... The server forks a receiving thread like the client. ...
    (comp.os.vms)
  • Re: Threaded chat server
    ... Typically, an IO::Select server, is preferred, because it handles ... Alternatively, to forking, you can spawn threads to handle each client. ... handed the client socket filehandle, and you can just use IO::Socket ... that fork and use IO::Select. ...
    (perl.beginners)
  • Re: HPUX sleep effect on CPU time slize and thread priority
    ... application is spawn by another application called server. ... them is recently patched to sleep just between being fork and spawn. ...
    (comp.sys.hp.hpux)
  • Re: sockets, events, and threads
    ... It has nothing to do with the sockets. ... Fx if you are writing a chat server or a time ... you don't want to create a process for every client. ... Applications the qualify for been concurrent (using fork()) are programs ...
    (comp.unix.programmer)