10 More Discussions You Might Find Interesting
1. Programming
I understand that fork create a child but I need very simple example that make child useful....
I mean how will make the program faster anyone explain with code plz
using C plz (2 Replies)
Discussion started by: fwrlfo
2 Replies
2. UNIX for Dummies Questions & Answers
I'm trying to run a simple test on how to use fork(), i'm able to execute the child process first then the parent, but how can I execute parent then child..?
Thanks! (1 Reply)
Discussion started by: l flipboi l
1 Replies
3. Programming
Hello people.
I'm trying to do something like a search engine.
Server runs in the background by using ./server & which has data from a textfile stored in an array.
Client then runs by using ./client
It will then prompt "Search for:"
For example, if I searched for Products called Instant... (0 Replies)
Discussion started by: andylbh
0 Replies
4. Programming
I need to write a program which creates some n number of processes first and also creates a fifo for each of them, then it connects to the server and..
I tried creating these processes with fork() in a for loop but it doesn't print out what i write inside the child..
for(int count = 0; count... (7 Replies)
Discussion started by: saman_glorious
7 Replies
5. Programming
Hi everybody,
I wanna write a code to understand how fork works.
my target
--------------
-Parent creates a file(called temp) and writes into this file "1".Then it closes the file.
-Then parent creates a child and wait until execution of this child ends.
-Then child opens the same... (3 Replies)
Discussion started by: alexicopax
3 Replies
6. Programming
hi all
About this code
for (i = 1; i < n; i++)
if ((childpid = fork()) <= 0)
break;
I really can't understand the output .
and the way fork () return the value .
how about the process Id ,the child process Id and the parent ID
in this case
so please answer me soon (5 Replies)
Discussion started by: iwbasts
5 Replies
7. Programming
hello,
Every time i use fork() in the for loop, my college network(which i work in) either gets slow or hangs up.Can any 1 explain why it is so?
Of course there is no use of doing it though. But still i want to clear my doubt.
Thanks (2 Replies)
Discussion started by: cyno
2 Replies
8. Programming
I run this code, actually I want to both processes print the message from "data". But only one does. What happens? Anyone can help?
#include <stdio.h>
main(){
int fd, pid;
char x;
fd = open("data",0); /* open file "data" */
pid = fork();
if(pid != 0){
wait(0);
... (2 Replies)
Discussion started by: Herman
2 Replies
9. Shell Programming and Scripting
I need a quick script that will serve as a sort of "real time monitor" for watching some log files. I am using Bourne shell in HP-UX 10.20. I have basically created a script that never ends, unless of course I manually terminate it. Here's the script (it's called qhistory):
clear
echo "REAL... (3 Replies)
Discussion started by: cdunavent
3 Replies
10. UNIX for Dummies Questions & Answers
What is a fork? Why would one create a fork? What are the advantages and disadvantages of using a fork?
Please advise.
Thank You.
Deepali (5 Replies)
Discussion started by: Deepali
5 Replies
IO::Async::Loop::Epoll(3pm) User Contributed Perl Documentation IO::Async::Loop::Epoll(3pm)
NAME
IO::Async::Loop::Epoll - use "IO::Async" with "epoll" on Linux
SYNOPSIS
use IO::Async::Loop::Epoll;
use IO::Async::Stream;
use IO::Async::Signal;
my $loop = IO::Async::Loop::Epoll->new();
$loop->add( IO::Async::Stream->new(
read_handle => *STDIN,
on_read => sub {
my ( $self, $buffref ) = @_;
while( $$buffref =~ s/^(.*)
?
// ) {
print "You said: $1
";
}
},
) );
$loop->add( IO::Async::Signal->new(
name => 'INT',
on_receipt => sub {
print "SIGINT, will now quit
";
$loop->loop_stop;
},
) );
$loop->loop_forever();
DESCRIPTION
This subclass of IO::Async::Loop uses IO::Epoll to perform read-ready and write-ready tests so that the O(1) high-performance multiplexing
of Linux's epoll_pwait(2) syscall can be used.
The "epoll" Linux subsystem uses a registration system similar to the higher level IO::Poll object wrapper, meaning that better performance
can be achieved in programs using a large number of filehandles. Each epoll_pwait(2) syscall only has an overhead proportional to the
number of ready filehandles, rather than the total number being watched. For more detail, see the epoll(7) manpage.
This class uses the epoll_pwait(2) system call, which atomically switches the process's signal mask, performs a wait exactly as
epoll_wait(2) would, then switches it back. This allows a process to block the signals it cares about, but switch in an empty signal mask
during the poll, allowing it to handle file IO and signals concurrently.
CONSTRUCTOR
$loop = IO::Async::Loop::Epoll->new()
This function returns a new instance of a "IO::Async::Loop::Epoll" object.
METHODS
As this is a subclass of IO::Async::Loop, all of its methods are inherited. Expect where noted below, all of the class's methods behave
identically to "IO::Async::Loop".
$count = $loop->loop_once( $timeout )
This method calls the "poll()" method on the stored "IO::Epoll" object, passing in the value of $timeout, and processes the results of that
call. It returns the total number of "IO::Async::Notifier" callbacks invoked, or "undef" if the underlying "epoll_pwait()" method returned
an error. If the "epoll_pwait()" was interrupted by a signal, then 0 is returned instead.
SEE ALSO
o IO::Epoll - Scalable IO Multiplexing for Linux 2.5.44 and higher
o IO::Async::Loop::Poll - use IO::Async with poll(2)
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-04-10 IO::Async::Loop::Epoll(3pm)