🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #6714

Re: Consultas Teoría linux

#6714
From: Alberto Giménez
Date: Thu, 29 May 2003 19:28
60 lines
2855 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

El 29 May 2003 10:51:27 -0700, Tuareg escribi�:
> 1.-	Me pod�is indicar que har�a este trozo de c�digo:
> 
> main()
> {
>   char c;
> 
>   while (read(0, &c, 1) > 0) 
Mientras haya car�cteres que leer...

>   {
>     switch (fork())
bifurcamos (crear otro proceso exactamente igual)

>     {
>       case 0: break;
Si seguimos en el hijo, salimos del switch (otra iteraci�n

> 
>       default: wait(NULL);
sino (estamos en el padre), esperamos a que acabe el hijo

>                write(1, &c, 1);
y escribimos el car�cter le�do
>     }
>   }
> }
> 

> 2.- Suponiendo que lanzamos desde  shell la l�nea de comando “ls
> | wc” , imaginemos que el proceso wc se ejecuta m�s r�pido que
> el proceso q ejecuta ls (puede ocurrir �?), y suponiendo que
Poder ocurrir, podr�a, pero no pasar�a nada, ya que wc se quedar�a
"esperando" a que alguien (ls, mediante la pipe) le mandara datos
Por cierto, eso de #8221 que es? n�mero de proceso? alguna orden? :? (lo
ignorar�)

> ocurriera, cuando el proceso “wc” quiera leer de la pipe y
> vea que esta vac�a, que pasara �?
Pues que se esperar� a que alguien le ponga algo, y hasta que le entre
el final de fichero, no mostrar� resultados.

Saludos

- -- 
Alberto Gim�nez, SimManiac en el IRC
http://www.geocities.com/simmaniac_es
GNU/Linux Debian Woody 3.0 GnuPG ID: 0x3BAABDE1
Linux registered user #290801
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+1l9U0keCtzuqveERArcSAKCGY725sy2X6XHcRBXfBc2bFne+rACfUj1d
h7oTbUWCsNzj+jZ+Aydu5ww=
=Mr52
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <k0n5bb.df.ln@teleline.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!east.cox.net!cox.net!antonio.escomposlinux.org!teleline.es!nobody
References: <e2eee5e.0305290951.5d2828a5@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,121407ccb19ffd5
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-05-29 13:15:53 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!east.cox.net!cox.net!antonio.escomposlinux.org!teleline.es!nobody
From: Alberto Giménez <algibe@teleline.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Consultas Teoría linux
Date: Thu, 29 May 2003 21:28:20 +0200
Organization: Ecolnet
Lines: 60
Message-ID: <k0n5bb.df.ln@teleline.es>
References: <e2eee5e.0305290951.5d2828a5@posting.google.com>
Reply-To: algibe@teleline.es
NNTP-Posting-Host: 102-bar2-x85.libre.retevision.es
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: antonio.escomposlinux.org 1054239350 21192 62.82.166.102 (29 May 2003 20:15:50 GMT)
X-Complaints-To: antonio@escomposlinux.org
NNTP-Posting-Date: Thu, 29 May 2003 20:15:50 +0000 (UTC)
User-Agent: slrn/0.9.7.4 (Linux)