diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd06067 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +1 zmiana w pliku readme + + +zmiana readme w komputerze \ No newline at end of file diff --git a/Zadania_domowe/zajecia6/prod-cons.cm b/Zadania_domowe/zajecia6/prod-cons.cm new file mode 100644 index 0000000..8a20fdb --- /dev/null +++ b/Zadania_domowe/zajecia6/prod-cons.cm @@ -0,0 +1,29 @@ +semaphore s; +semaphore t; +int liczba; + +void kons(){ + int i; + for(i=0; i<10; i=i+1){ + wait(t); + cout << liczba << endl; + signal(s); + } +} + +void prod(){ + int i; + for(i=0; i<10; i=i+1){ + wait(s); + liczba=i; + signal(t); + } +} + +main(){ + initialsem(s, 1); + initialsem(t, 0); + cobegin{ + prod(); kons(); + } +} diff --git a/Zadania_domowe/zajecia6/prod-cons.lst b/Zadania_domowe/zajecia6/prod-cons.lst new file mode 100644 index 0000000..71b3a3d --- /dev/null +++ b/Zadania_domowe/zajecia6/prod-cons.lst @@ -0,0 +1,32 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: prod-cons.cm Tue Dec 4 15:01:25 2018 + line pc + 1 0 semaphore s; + 2 0 semaphore t; + 3 0 int liczba; + 4 0 + 5 0 void kons(){ + 6 0 int i; + 7 0 for(i=0; i<10; i=i+1){ + 8 14 wait(t); + 9 16 cout << liczba << endl; + 10 19 signal(s); + 11 21 } + 12 22 } + 13 23 + 14 23 void prod(){ + 15 23 int i; + 16 23 for(i=0; i<10; i=i+1){ + 17 37 wait(s); + 18 39 liczba=i; + 19 42 signal(t); + 20 44 } + 21 45 } + 22 46 + 23 46 main(){ + 24 47 initialsem(s, 1); + 25 50 initialsem(t, 0); + 26 53 cobegin{ + 27 54 prod(); kons(); + 28 60 } + 29 61 } diff --git a/Zadania_domowe/zajecia6/prod-cons.pco b/Zadania_domowe/zajecia6/prod-cons.pco new file mode 100644 index 0000000..885d06d --- /dev/null +++ b/Zadania_domowe/zajecia6/prod-cons.pco @@ -0,0 +1,112 @@ +BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 +Source file: prod-cons.cm Tue Dec 4 15:01:25 2018 +0 62 PCODE table + lc f x y + 0 0 1 5 + 1 24 0 0 + 2 38 0 0 + 3 1 1 5 + 4 24 0 10 + 5 47 0 0 + 6 15 0 22 + 7 14 0 14 + 8 0 1 5 + 9 1 1 5 + 10 24 0 1 + 11 52 0 0 + 12 38 0 0 + 13 14 0 3 + 14 0 0 1 + 15 6 0 0 + 16 1 0 2 + 17 29 0 1 + 18 63 0 0 + 19 0 0 0 + 20 7 0 0 + 21 14 0 8 + 22 32 0 0 + 23 0 1 5 + 24 24 0 0 + 25 38 0 0 + 26 1 1 5 + 27 24 0 10 + 28 47 0 0 + 29 15 0 45 + 30 14 0 37 + 31 0 1 5 + 32 1 1 5 + 33 24 0 1 + 34 52 0 0 + 35 38 0 0 + 36 14 0 26 + 37 0 0 0 + 38 6 0 0 + 39 0 0 2 + 40 1 1 5 + 41 38 0 0 + 42 0 0 1 + 43 7 0 0 + 44 14 0 31 + 45 32 0 0 + 46 80 0 62 + 47 0 0 0 + 48 24 0 1 + 49 39 0 0 + 50 0 0 1 + 51 24 0 0 + 52 39 0 0 + 53 4 0 0 + 54 18 0 7 + 55 19 0 4 + 56 3 0 1 + 57 18 0 5 + 58 19 0 4 + 59 3 0 1 + 60 5 0 0 + 61 31 0 0 + 62 81 0 0 +1 9 IDENTIFIER table +index identifier link obj type ref normal lev adr mon atomic + 1 ++-outer-++ 0 7 0 0 1 0 62 0 0 + 2 s 1 1 5 0 1 0 0 0 0 + 3 t 2 1 5 0 1 0 1 0 0 + 4 liczba 3 1 1 0 1 0 2 0 0 + 5 kons 4 3 0 1 1 0 0 0 0 + 6 i 0 1 1 0 1 1 5 0 0 + 7 prod 5 3 0 2 1 0 23 0 0 + 8 i 0 1 1 0 1 1 5 0 0 + 9 main 7 6 0 3 1 0 46 0 0 +0 3 BLOCK table +index last lastpar psize vsize + 0 9 9 0 3 + 1 6 5 5 6 + 2 8 7 5 6 + 3 9 9 5 5 +0 -1 ARRAY table +index inxtype eltyp elref low high elsize size +0 0 60 STRING table +0 0 Input File array +index parent file name + 0 -1 prod-cons.cm +0 19 PCODE debugging information + lc findex flineno + 0 0 7 + 14 0 8 + 16 0 9 + 19 0 10 + 21 0 11 + 22 0 12 + 23 0 16 + 37 0 17 + 39 0 18 + 42 0 19 + 44 0 20 + 45 0 21 + 46 0 23 + 47 0 24 + 50 0 25 + 53 0 26 + 54 0 27 + 60 0 28 + 61 0 29 + 62 0 -29 diff --git a/Zadania_domowe/zajecia6/seq.cm b/Zadania_domowe/zajecia6/seq.cm new file mode 100644 index 0000000..0b4f706 --- /dev/null +++ b/Zadania_domowe/zajecia6/seq.cm @@ -0,0 +1,26 @@ +semaphore s; +semaphore t; + +void a(){ + cout << "Proces 1" <