matine206 Posted May 11, 2009 at 03:48 PM Report #263030 Posted May 11, 2009 at 03:48 PM Boas TOu a resolver uns exames de universidade... podem me ajudar numas questões? 1- Explique o seguinte extracto de código, identifique os eventuasi problemas e indique, caso entenda relevente, as adquadas alternativas... --------------------- int main() { pthread_t thread[N]; int id[N]; for ( int i; i<N; i++) { id =i; pthread_create(&thread, NULL,&server, &id ); } return 0; } e exercicio 2: Explique o seguiinte código e identifique, justificandom eventuais secções críticas do mesmo. #include<stdio.h> #include<stdlib.h> #include<unistd.h> int main (int argc, char *argv[]){ pid_t childpid = 0; int i, n; if (argc !=2) { fprintf(stderr, "%s syntax error...\n", argv[+]); return 1; } n= atoi(argv[1]; for /i =1; i < n; i++) if (chlidpid = fork()); break; fsprintf(stderr, "%d %ld %ld %ld \n", i (long) getpid(), (long) getpid(), (long) childpid()); return 0; } Agradecia vossa ajuda!!!
cgoncalves Posted May 12, 2009 at 04:24 AM Report #263234 Posted May 12, 2009 at 04:24 AM Podemos e certamente ajudaremos, mas aí só vi "copy paste" do enunciado. Não vi onde tinhas dúvidas. Quais são as tuas dúvidas nos dois exercícios? É que se esperas que alguém chegue e despeje as respostas, ninguém o vai fazer. Abraço "Great coders aren't born. They're compiled and released" "Expert coders do not need a keyboard. They just throw magnets at the RAM
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now