Jawaharlal Nehru Technological University Hyderabad
Jawaharlal Nehru Technological University Hyderabad B.Tech IV Year REAL TIME SYSTEMS Previous Question Paper (February/March - 2022 - R18)
Answer Any Five Questions. All Questions carry equal marks.
Main
Give the correct syntax of read() and write() system calls and explain.
Answer
The read() and write() system calls are fundamental primitives in Unix-like operating systems for performing I/O operations on file descriptors.
- read() System Call: Used to read data from a file descriptor into a buffer.
- Parameters:
- fd: The file descriptor associated with the file to read from.
- buf: A pointer to the memory buffer where the read data will be stored.
- count: The maximum number of bytes to read.
- Return Value: Returns the number of bytes read on success, 0 on end-of-file, or -1 on error.
- write() System Call: Used to write data from a buffer to a file descriptor.
- Parameters:
- fd: The file descriptor associated with the file to write to.
- buf: A pointer to the buffer containing the data to be written.
- count: The number of bytes to write from the buffer.
- Return Value: Returns the number of bytes written on success, or -1 on error.
Write a C program to copy the content of one file to another file using relevant system calls.
Answer
The following C program demonstrates file copying using the open(), read(), write(), and close() system calls.
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main() {
int fd_src, fd_dest;
char buffer[1024];
ssize_t n;
fd_src = open("source.txt", O_RDONLY);
if (fd_src < 0) { perror("Error opening source"); return 1; }
fd_dest = open("dest.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd_dest < 0) { perror("Error opening destination"); return 1; }
while ((n = read(fd_src, buffer, sizeof(buffer))) > 0) {
write(fd_dest, buffer, n);
}
close(fd_src);
close(fd_dest);
return 0;
}Note: The O_CREAT flag creates the destination file if it does not exist, and O_TRUNC clears existing content.
Discuss the various status flags and file modes associated with an open( ) and creat( ) system calls.
Answer
Sign in to view the complete answer paper.
Write the syntax of exec() family of system calls and explain any two of them.
Answer
Sign in to view the complete answer paper.
How the priority based preemptive based scheduling is different from the round-robin scheduling? Explain briefly.
Answer
Sign in to view the complete answer paper.
Give a detail note on various parameters, states and data structures associated with a task in ROTS.
Answer
Sign in to view the complete answer paper.
Describe the key characteristics of an Real Time Operating System.
Answer
Sign in to view the complete answer paper.
What is a Message Queue? Explain various message queue operations.
Answer
Sign in to view the complete answer paper.
Explain various operations that can be performed on a pipe.
Answer
Sign in to view the complete answer paper.
What is an event register? List and give the description of various entries in event control block.
Answer
Sign in to view the complete answer paper.
Give a detail note on file-system component and remote procedure call component.
Answer
Sign in to view the complete answer paper.
Explain briefly about Port-Mapped I/O, Memory-Mapped I/O and DMA.
Answer
Sign in to view the complete answer paper.
State the need of Programmable Interval Timer. Explain the steps in servicing the timer interrupt.
Answer
Sign in to view the complete answer paper.
Describe the model for implementing a soft timer handling facility.
Answer
Sign in to view the complete answer paper.
How to schedule tasks in MicroC/OS-II? Explain in detail with an illustration.
Answer
Sign in to view the complete answer paper.