Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with...
-
Upload
christian-beasley -
Category
Documents
-
view
214 -
download
1
Transcript of Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with...
![Page 1: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.](https://reader036.fdocuments.in/reader036/viewer/2022082819/56649f265503460f94c3cd78/html5/thumbnails/1.jpg)
Data Communications and Networking COMP 2330
Laboratory 6
Mr. Wilman ZOU
Please sign your name with your attendance
![Page 2: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.](https://reader036.fdocuments.in/reader036/viewer/2022082819/56649f265503460f94c3cd78/html5/thumbnails/2.jpg)
Job 1
Job 2
Job 3
Single Thread
Job 2Job 1Job 3
Multi-thread
Job1,job2,job3
Job1,job2,job3
![Page 3: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.](https://reader036.fdocuments.in/reader036/viewer/2022082819/56649f265503460f94c3cd78/html5/thumbnails/3.jpg)
Some functions• _beginthread()
– To create a new thread;– uintptr_t _beginthread( void( *start_address )
( void * ), unsigned stack_size, void *arglist ); • void( *start_address )( void * ): a point to the
function/ • unsigned stack_size: specify the size of the
stack for the created thread• void *arglist: the pointer of arguments list
![Page 4: Data Communications and Networking COMP 2330 Laboratory 6 Mr. Wilman ZOU Please sign your name with your attendance.](https://reader036.fdocuments.in/reader036/viewer/2022082819/56649f265503460f94c3cd78/html5/thumbnails/4.jpg)
Some functions• fflush()
– To clean the buffer,– int fflush( FILE *stream );
• FILE *stream: a pointer to FILE structure, this FILE structure will base on a buffer
• When fflush try to clean the buffer, the system will first conduct the commands to treat the data in buffer
• Intuitively, fflush() after printf() means that display the printf() result without delay