Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

What is bufsize in c?

2 Answer(s) Available
Answer # 1 #

Which one of the assignments will give the correct solution?

(A) P: full, Q: full, R: empty, S: empty(B) P: empty, Q: empty, R: full, S: full(C) P: full, Q: empty, R: empty , S: full(D) P: empty, Q: full, R: full, S: emptyAnswer: (C)Explanation: Given,Empty = 0Full = NMutex = 1

You can't wait for empty semaphore in the first attempt.

The producer process must deal with empty and mutex semaphores, and the consumer process must deal with full and mutex semaphores.

The option causes starvation. Dehydration causes starvation. The consumer process can't consume if the number of filled slots are 0 initially. This implementation is not right.

Only P, Q, full, R, and S are correct orders to ensure a free implementation.

The option is correct.

[10]
Edit
Query
Report
Adnan Saravanan
SUPERVISOR FLAME CUTTING
Answer # 2 #

BUFSIZ is used for the operations of Streaming C functions. The code holds the output in buffer until the input is received from the getchar function at Line 13. The program's output appears at once. Refer to the earlier post for more details.

The BUFSIZ defined constant can be used to declare your code's buffer size. I get the best of myself when I ask how big BUFSIZ is. What is its value?

stdio.h contains all the files you need to locate the BUFSIZ declaration, but you can just run the following code.

The %d placeholder is used to output the value because BUFSIZ is assigned an int.

Here's what appears on my computer.

The BUFSIZ buffer is set to a certain size.

A 1K buffer is nice, but here's the output for Linux.

The BUFSIZ buffer is set to 8192

The buffer size is 8K, or 8,192 bytes. I don't know what it is.

[5]
Edit
Query
Report
Alanna Devon
Platelayer