As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [xv6]

Use this tag if your question is about the xv6 OS (a "pedagogical" reimplementation of Unix v6, as used in MIT's 6.828 course) and do NOT want to mislead people into giving answers which assume Linux or other modern Unix system, which are quite different both in their implementation and interfaces.

Filter by
Sorted by
Tagged with
0 votes
1 answer
98 views

Working of grep in xv6 implementation?

char buf[1024]; void grep(char *pattern, int fd) { int n, m; char *p, *q; m = 0; while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){ m += n; buf[m] = '\0'; p = buf; while((...
arka's user avatar
  • 161
0 votes
1 answer
347 views

Why can't user process READ memory in kernel address space?

It seems fairly obvious why user processes can't write or modify data on kernel address space. But I can't get my head around why they can't even read the data. I know that a segmentation trap would ...
Mahdi Vakili's user avatar
1 vote
0 answers
337 views

Writing an OS shutdown process for QEMU (xv6)

Background: I'm using QEMU to virtualize xv6-riscv on top of WSL2. I'm looking to create some sort of clean OS shutdown process reminiscent of Linux's exit command. Currently I'm using Ctrl-a x to ...
Jakob Lovern's user avatar
-1 votes
1 answer
1k views

What does file descriptor have to do with process table?

I have an interest in Operating Systems. So I am reading the xv6 book to understand Operating Systems. This is my first book on the subject. I read a line I couldn't understand. Internally, the xv6 ...
Vishal Dalwadi's user avatar
2 votes
3 answers
734 views

How does the shell/init create the stdio streams?

I am reading through the source of MIT's xv6 OS. This snippet comes at the beginning of sh.c: // Ensure that three file descriptors are open. while((fd = open("console", O_RDWR)) >= 0){ if(fd &...
Shrikant Giridhar's user avatar
2 votes
2 answers
3k views

open() console for default file descriptors

I'm reading a shell program implementation in C ( the xv6 shell from MIT's 6.828 Operating System Engineering course ). The main() function for this shell starts with the following code: //Assumes ...
Rany Albeg Wein's user avatar