Skip to content

Commit

Permalink
Adicionando apresentacao
Browse files Browse the repository at this point in the history
  • Loading branch information
ferschubert-hm committed Aug 17, 2024
1 parent e4613ba commit b718910
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Binary file not shown.
Binary file added Linguagem_De_Programacao_IV/exercicios/fork-1
Binary file not shown.
33 changes: 33 additions & 0 deletions Linguagem_De_Programacao_IV/exercicios/fork-1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
pid_t pid, pid2;
int estado;

pid = fork(); /* Cria um PROCESSO */if (pid < 0)
{
printf("Erro ao criar o processo\n");
exit(-1);
}
else if (pid > 0) /* Código que só vai ser executado pelo Processo PAI */
{
printf("Eu sou o PAI\n");
printf("Papai estah esperando vc...\n");
pid2 = wait(&estado);
printf("To pronto pai!\n");
printf("O filho com o pid %d terminou\n", pid2);
}
else /* Código que só vai ser executado pelo Processo FILHO */
{
printf("Processo Filho\n");
}

printf("REPETIDO\n");

return 0;
}
11 changes: 11 additions & 0 deletions Linguagem_De_Programacao_IV/exercicios/fork-1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

p = fork();

a = fork();



printf("Linguagens IV\n");

?>
Binary file not shown.

0 comments on commit b718910

Please sign in to comment.