miércoles, 2 de noviembre de 2011

2nd part
View more presentations from dgzz
I was trying to make a FIFO simulation, but it does not work, although i think this code is more adapted for three frames.
Well this code is in C, and it's just the part of the main, because the other are FIFO functions.
This writes the numbers, but sometimes it writes the same number two times.
So, i know this code is bad. I just wanted to try. Here is the code:



    for( i = 0; i < TAMANIO; i++ ){
        for( j = 0; j < 3; j++ ){
            b[ j ] = a[ j ];

        }
           
            agregar( &ptrCabeza, &ptrTalon, a[ i ] );

            if( b[ i ] != a[ i ] ){
                retirar( &ptrCabeza, &ptrTalon );
               
            }
                if( b[ i ] == a[ i + 1 ] ){
                    retirar( &ptrCabeza, &ptrTalon );
                    agregar( &ptrCabeza, &ptrTalon, a[ i + 1 ] );
                }
                else{
                    if( b[ i ] == a[ i + 2 ] ){
                        retirar( &ptrCabeza, &ptrTalon );
                        agregar( &ptrCabeza, &ptrTalon, a[ i + 2 ] );
                    }
                }
               
           
        imprimeCola( ptrCabeza );



 


And this code can be a simulation how to copy some file:

#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>

int main( int argc, char *argv[] );

#define TAM_BUF 4096
#define MODO_SALIDA 700

int main( int argc, char *argv[] )
{
    int ent_da, sal_da, leer_cuenta, escribir_cuenta;
    char bufer[ TAM_BUF ];

    if( argc != 3 ) exit( 1 );

    ent_da = open( argv[ 1 ], O_RDONLY );
    if( ent_da < 0 )
    exit( 2 );
    sal_da = open( argv[ 2 ], MODO_SALIDA );
    if( sal_da < 0 )
    exit( 3 );

    while( 1 ){

        leer_cuenta = read( ent_da, bufer, TAM_BUF );
        if( leer_cuenta <= 0 )
            break;
            escribir_cuenta = write( sal_da, bufer, leer_cuenta );
        if( escribir_cuenta <= 0 )
        break;
    }

    close( ent_da );
    close( sal_da );
    if( leer_cuenta == 0 )
        exit( 0 );
    else
        exit( 5 );
}
 

lunes, 8 de agosto de 2011

Welcome

Hello...!!! Welcome to Operating Systems' class with the Dr. Elisa Schaeffer...!! We hope you are fine. This blog will be used for the class which will be in English, so, we can find two good points the first, we'll have more knowledge about the subject (Operating Systems) and the second we can pratice more the English.

Well, the students in this team are:
- Mariel
- Daniel
- Victor

and we just want to wish you Good luck..!!