SlideShare a Scribd company logo
1 of 10
Facultad de Ciencias Humanas
       y de la Educación
  Carrera de Docencia en Informática


   LECTORES Y ESCRITORES
     Nombre: María del Cisne Loján
             Silvia Chango
             Lusy Chisag

       Tutor: Ing.Javier Sánchez
       Semestre: Séptimo

   Septiembre 2011- Febrero 2012
FUNCIÓN MAIN




   Crea un                     Su proceso
proceso padre                    hijo los




                 Lectores
                 Escritores
Base de datos




    Lector                              Escritor




  Varios lectores
 Pueden acceder
     registro                       Solo uno escribir
simultáneamente
Cómo resolver
                                  el problema



      Identificar
        estado                            Se debe                   Identifica
                                          contar a
     compartido y                                                  Condiciones
                                             los
      restringido                         lectores                 de espera y
                                                                   señalización


   Lector                                                Lector
                    Escritor                                                 Escritor
  escritor                                              escritor

                No admite otro                                             Cuando termine
No se accede                                         Si existe BD debe     debe señalizar el
                  escritor ni
base de datos       lector                                 esperar            que esta
                                                                             esperando
monitor ReadWriter;
export
open(iswriter: Boolean);
close(isReader:Boolean);
var
readerCount:Integer;
activeW: Boolean
okeyRead, okeyWrite: condition;
procedure open(isReader: Boolean);begin ... end;
procedure open(isReader: Boolean);begin ... end;.
begin
activeW:=False;
readCount:=0;
end;
procedure open(isReader:Boolean);    procedure close(isReader:
begin                                Boolean);
if isReader then begin               begin
if activeW or not empty(okeyWrite)   if isReader then begin
then delay(okeyRead);                readCount:=readCount-1;
readCount:=readCount+1;              if (readCount=0)
resume(okeyRead)                     then resume(okeyWrite);
end else begin -- is writer          end else begin
if activeW or (readCount<>0)         activeW:=False;
then delay(okeyWrite);               if not empty(okeyRead)
activeW:=True;                       then resume(okeyRead);
end;                                 else resume(okeyWrite);
                                     end;
program AlarmClock;
const NUM_SLEEPER=3;
monitor alarm; ...
monitor screen ...
process driver ...
process type SleeperType ...
var sleepers: array [1..NUM_SLEEPER] of SleeperType;
i:Integer
begin
cobegin driver; for i:=1 to NUM_SLEEPER do sleepers[i](i); coend;
end;
Lectores y escritores

More Related Content

Viewers also liked

Institutii culturale constantene
Institutii culturale constanteneInstitutii culturale constantene
Institutii culturale constantenePishta Bmc
 
1 q10 conference call presentation
1 q10 conference call presentation1 q10 conference call presentation
1 q10 conference call presentationSantander_ri
 
Nuevo trabajo 2
Nuevo trabajo 2Nuevo trabajo 2
Nuevo trabajo 2alejoxs
 
First class d. s. handbook final
First class d. s. handbook finalFirst class d. s. handbook final
First class d. s. handbook finaldalufcds
 
Beta testing with CI
Beta testing with CIBeta testing with CI
Beta testing with CILiyao Chen
 
Foregin language instruction
Foregin language instructionForegin language instruction
Foregin language instructionhallarmh
 
Partner update 17 October 2014
Partner update 17 October 2014Partner update 17 October 2014
Partner update 17 October 2014newcastlegateshead
 
Fluke Test Tools Catalog 2010/2011
Fluke Test Tools Catalog 2010/2011Fluke Test Tools Catalog 2010/2011
Fluke Test Tools Catalog 2010/2011FlukeinMalta
 
Solution Selling 2.0 interview met Keith Eades in Sales Management Magazine
Solution Selling 2.0 interview met Keith Eades in Sales Management MagazineSolution Selling 2.0 interview met Keith Eades in Sales Management Magazine
Solution Selling 2.0 interview met Keith Eades in Sales Management MagazineRenevoogt
 
2 seqüències didàctiques ins jaume i
2  seqüències didàctiques ins jaume i2  seqüències didàctiques ins jaume i
2 seqüències didàctiques ins jaume iICE_URV_NU
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting staredLiyao Chen
 
писатели юбиляры
писатели юбилярыписатели юбиляры
писатели юбилярыAndrey Tokarchuk
 

Viewers also liked (19)

Presentation4MacCarthy
Presentation4MacCarthyPresentation4MacCarthy
Presentation4MacCarthy
 
Institutii culturale constantene
Institutii culturale constanteneInstitutii culturale constantene
Institutii culturale constantene
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
1 q10 conference call presentation
1 q10 conference call presentation1 q10 conference call presentation
1 q10 conference call presentation
 
Smoking
SmokingSmoking
Smoking
 
Nuevo trabajo 2
Nuevo trabajo 2Nuevo trabajo 2
Nuevo trabajo 2
 
TSH - Focusing on Excellence
TSH - Focusing on ExcellenceTSH - Focusing on Excellence
TSH - Focusing on Excellence
 
Publicidade 2016
Publicidade 2016Publicidade 2016
Publicidade 2016
 
First class d. s. handbook final
First class d. s. handbook finalFirst class d. s. handbook final
First class d. s. handbook final
 
Beta testing with CI
Beta testing with CIBeta testing with CI
Beta testing with CI
 
Nvidia grid-2
Nvidia grid-2Nvidia grid-2
Nvidia grid-2
 
Foregin language instruction
Foregin language instructionForegin language instruction
Foregin language instruction
 
Partner update 17 October 2014
Partner update 17 October 2014Partner update 17 October 2014
Partner update 17 October 2014
 
Fluke Test Tools Catalog 2010/2011
Fluke Test Tools Catalog 2010/2011Fluke Test Tools Catalog 2010/2011
Fluke Test Tools Catalog 2010/2011
 
2011 05-28 tsh foundation
2011 05-28 tsh foundation2011 05-28 tsh foundation
2011 05-28 tsh foundation
 
Solution Selling 2.0 interview met Keith Eades in Sales Management Magazine
Solution Selling 2.0 interview met Keith Eades in Sales Management MagazineSolution Selling 2.0 interview met Keith Eades in Sales Management Magazine
Solution Selling 2.0 interview met Keith Eades in Sales Management Magazine
 
2 seqüències didàctiques ins jaume i
2  seqüències didàctiques ins jaume i2  seqüències didàctiques ins jaume i
2 seqüències didàctiques ins jaume i
 
iOS Unit test getting stared
iOS Unit test getting starediOS Unit test getting stared
iOS Unit test getting stared
 
писатели юбиляры
писатели юбилярыписатели юбиляры
писатели юбиляры
 

More from Lusy Chisag

More from Lusy Chisag (18)

Formato Proyecto
Formato ProyectoFormato Proyecto
Formato Proyecto
 
Cuadro de recuperacion
Cuadro de recuperacionCuadro de recuperacion
Cuadro de recuperacion
 
Trabajo de lengua
Trabajo de lenguaTrabajo de lengua
Trabajo de lengua
 
Conducta humana
Conducta humanaConducta humana
Conducta humana
 
Informe
InformeInforme
Informe
 
Plataforma social educativa
Plataforma social educativaPlataforma social educativa
Plataforma social educativa
 
TAREA
TAREATAREA
TAREA
 
Auditoria informática
Auditoria informáticaAuditoria informática
Auditoria informática
 
Glosario lucy chisag
Glosario lucy chisagGlosario lucy chisag
Glosario lucy chisag
 
Glosario lucy chisag
Glosario lucy chisagGlosario lucy chisag
Glosario lucy chisag
 
los habitos
los habitoslos habitos
los habitos
 
Teoriadelapsicmotricidad
TeoriadelapsicmotricidadTeoriadelapsicmotricidad
Teoriadelapsicmotricidad
 
Dns
DnsDns
Dns
 
Shell
ShellShell
Shell
 
TAREA_8
TAREA_8TAREA_8
TAREA_8
 
TAREA 6
TAREA 6TAREA 6
TAREA 6
 
TAREA 8
TAREA 8TAREA 8
TAREA 8
 
Tipos de servidores
Tipos de servidoresTipos de servidores
Tipos de servidores
 

Lectores y escritores

  • 1. Facultad de Ciencias Humanas y de la Educación Carrera de Docencia en Informática LECTORES Y ESCRITORES Nombre: María del Cisne Loján Silvia Chango Lusy Chisag Tutor: Ing.Javier Sánchez Semestre: Séptimo Septiembre 2011- Febrero 2012
  • 2. FUNCIÓN MAIN Crea un Su proceso proceso padre hijo los Lectores Escritores
  • 3. Base de datos Lector Escritor Varios lectores Pueden acceder registro Solo uno escribir simultáneamente
  • 4. Cómo resolver el problema Identificar estado Se debe Identifica contar a compartido y Condiciones los restringido lectores de espera y señalización Lector Lector Escritor Escritor escritor escritor No admite otro Cuando termine No se accede Si existe BD debe debe señalizar el escritor ni base de datos lector esperar que esta esperando
  • 5.
  • 6.
  • 7. monitor ReadWriter; export open(iswriter: Boolean); close(isReader:Boolean); var readerCount:Integer; activeW: Boolean okeyRead, okeyWrite: condition; procedure open(isReader: Boolean);begin ... end; procedure open(isReader: Boolean);begin ... end;. begin activeW:=False; readCount:=0; end;
  • 8. procedure open(isReader:Boolean); procedure close(isReader: begin Boolean); if isReader then begin begin if activeW or not empty(okeyWrite) if isReader then begin then delay(okeyRead); readCount:=readCount-1; readCount:=readCount+1; if (readCount=0) resume(okeyRead) then resume(okeyWrite); end else begin -- is writer end else begin if activeW or (readCount<>0) activeW:=False; then delay(okeyWrite); if not empty(okeyRead) activeW:=True; then resume(okeyRead); end; else resume(okeyWrite); end;
  • 9. program AlarmClock; const NUM_SLEEPER=3; monitor alarm; ... monitor screen ... process driver ... process type SleeperType ... var sleepers: array [1..NUM_SLEEPER] of SleeperType; i:Integer begin cobegin driver; for i:=1 to NUM_SLEEPER do sleepers[i](i); coend; end;