A
Aloo
hi everybody,
I was recently trying theading in c on linux using the standard
threading library. It was a small program for printing a sequence of
numbers.
I encountered 2 problems
1) Each process completed its entire operation the moment it was
called. The output I got was 01234567891023456789 whereas I was
expecting 00112233445566778899. Is it due to that the process was so
small that it finished in the time slice alotted it OR is there any
other reason. Can I get the output I expected from it without insertion
of delays.
2) I was earlier using printf but ws getting the output at the end of
process completion even with delay in place. Later I got to know that
'printf' does not have re-entrant code. I want to know why is it
required? and how does it make the program work differently ?
I was recently trying theading in c on linux using the standard
threading library. It was a small program for printing a sequence of
numbers.
I encountered 2 problems
1) Each process completed its entire operation the moment it was
called. The output I got was 01234567891023456789 whereas I was
expecting 00112233445566778899. Is it due to that the process was so
small that it finished in the time slice alotted it OR is there any
other reason. Can I get the output I expected from it without insertion
of delays.
2) I was earlier using printf but ws getting the output at the end of
process completion even with delay in place. Later I got to know that
'printf' does not have re-entrant code. I want to know why is it
required? and how does it make the program work differently ?