# Mini Project 2 Questions
# xv6
## Installation
## System calls
### 1. Gotta count 'em all
Q1) Can we use exec to run the command[args] ?
Q2) Can the parent call the getsyscount system call and print the returned value in parent,or does the getsystem call should print and return the count value ?
Q3) Do we need to count the no.of time a syscall is called for that particular command or all the commands till now ?
Q4) If the parent and child both calls the system call do we consider only child's count or do we have to add it to the parent's count as well?
command:syscount 128 adfad
output:
calling exec in 3 //I added a debug statement
calling exec in 4
exec failed!!
PID 4 called exec 2 times
Q5) The command result would be printed right? I have not changed their codes like for eg grep will print its result?
Q6) Do we need to count the number of times the systemcall is made by background processes also ?
Also why does background process do not print childs pid here?
Q7) Should the syscall also count no. of calls made by processes that are children/grandchildren after they have been orphaned?
Q8) what is the output of the command : syscount 65536 echo hello ? pls clarify
Q9) Can we store how many time it is called in the proc struct?
Q10) Do we need to add all the extra syscalls we are making like sysreturn etc?
Q11) Is it okay if some usertests are failing after modifications?
### 2. Wake me up when my timer ends
Q1) Do we test our code with `alarmtest.c` that is already present in the `user` folder?
Q2) Please give some testcases as currently I'm not able to understand what is to be done in this part?
Q3) When I am running `alarmtest` with 3 CPUs and the default scheduler, the alarmtest gives a output that is not expected because the scheduler does not support natively multiple CPUs. So, is using multiple CPUs needed for this?
Q4) alarmtest.c tests the syscall functionality by calling `sigalarm(interval, handler)` but the Specification tells that an application will call `alarm(interval, handler)`
You should add a new sigalarm(interval, handler) system call.
If an application calls alarm(n, fn) , then after every n ”ticks” of CPU time
that the program consumes, the kernel will cause application function fn to be called.
When fn returns, the application will resume where it left off.
Which one should we implement ?
## Scheduling
Q1) Will scheduling be tested on multiple CPUs? Or is implementing it for a single CPU enough?
Q2) Are there sample test case files for all the scheduling schemes?
Q3) Is there any way to check for the correctness of our implemented LBS? If no, then how can we be sure that our code is right.
### 1. The process powerball
Q1) If a process won the lottery and started running does it have to run till it exits or should the timer interrupt stop it at some point and make the lottery ticket again to run another process?
Q2) at one place it is mentioned that the default ticket=1 and in the note it is written that You’ll need to assign tickets to a process when it is created.so which one to follow?
Q3) How to check the correctness of our code? I mean like a sample file to test our program.
Q4) `By default, each process should get one ticket; calling this routine makes it such that a process can raise the number of tickets it receives,`
If a process is created it gets 1 ticket then by what number will the number of tickets increase on calling `settickets()`
Q5) How do we select a process randomly (with weightage given to the number of tickets they have)? Is there any random function in xv6 that can be used?
### 2. MLF who? MLFQ!
Q1) Do we need to implement queues in MLFQ using linkedlists or arrays are enough? Will we get any extra points if we implement it efficiently (if arrays are enough)?
Q2) For the report regarding MLFQ, do we need to show the data behind our plot or we can plot the graph based on our implementation?
# Networking
## 1. XOXO
Q1) Are we allowed to use threads? In the sense of the inbuilt functions for thread in the library `<pthread.h>`?
Q2) Can we have both clients playing the game in one terminal or is it compulsory to have a terminal for each player?? So implementation is like server operates through one terminal and both players through another terminal.
Q3) Should the game be accessible by users with different ip? that is server on one system and players on different systems?
Q4) Is it okay if the updated board with the move of player1 is only sent to the player2 or is it compulsory that both players should recieve the updated board ?
Q5) "You are required to design and implement a simple multiplayer Tic-Tac-Toe game using networking concepts." Does multi-player here mean multiple pairs of players or do we just have to allow 2 clients in total? What is the total number of games our server needs to support simultaneously?
Q6) When the server closes connection for both players, will it continue to wait for other players to connect or will it stop running ?
Q7) Instead of (coloumn, row), if we take input as numbers starting from 1 from top-left to 9 till bottom-right is it alright?
Q8) Can we use select()?
Q9) What is expected when:
The player who doesnot have a turn makes a move. As per the specification, we should ordinarily impose that the moves are made in correct order. So, should we keep the turn made in the buffer or should we print error messages.
Q10) Do we need server to handle multiple pair of clients that does we need to have multiple matches?
Q11) Do we need create different c files for TCP and UDP ? or do we need to do it in the same c file?
Q12) Is it okay if we hardcode the server's IP address (so the client knows the server's IP)?
Q13) What if its client 1’s turn but client 2 types something on the terminal?
Do we need to handle such cases?
Q14) Can we assume that once we have connected the client we will not send stop signal (ctrl Z) to server or other client?
Q15) The option to replay the game should be given to both clients together or we can ask one of the client first , and based on their response ask the second client?
Q16) If after games ends, and only one of the client refuses to replay, still the process for both clients as well as server should be stopped right ?
Q17) For implementing UDP can we use flags like MSG_CONFIRM, MSG_WAITALL ?vi
Q18) What is the expected behavior of clients when the server is terminated manually? Should both clients be terminated? Should only a message be sent to the clients saying "Server Disconnected". Similarly, what is the expected behavior of server when both or one of the clients is terminated manually? Currently I am terminating the clients in case server is terminated manually (using CTRL + C).
Q19) Should we print the board at server terminal as well?
Q20) Regarding q9 is it fine if we dont do anything and just clear the buffer if the player makes a move?
Q21) Regarding Q3, how exactly can we test if it works across different IP's on the same network? All the testing I've done is on the same machine, just different terminals. Is cross-machine compatibility required?
Q22) Can the server ip address be put as an argument while running the client? Eg `./client 192.168.1.1`
Q23) Can we assume that both the server/client terminal wont stop the game abruptly(ctrl-C or ctrl-Z)?
Q24) For every response received from client I have to enter a newline to continue normal execution, is it fine if I specify this in README??
## 2. Fake it till you make it
Q1) Pls explain what is use of non blocking sockets here
Q2) can we assume the max size of the message we are sending and receiving ( size=number_of_chunks* chunk_size) ?
Q3) Just like tic-tac-toe, can we assume that the client and server will take turns to send messages and not just server/client sending the messages? I mean, are we expected to implement the following case
`server sending "hi client" to the client`
`server sending "how are you doing?" to the client`
`client sending "hello server, I'm doing great" to the server`
or implementing the below case would suffice where server and client can only send messages alternatively
`server sending "hi client" to the client`
`client sending "hi server" to the server`
`server sending "how are you doing?" to the client`
`client sending "I'm doing great" to the server`
Q4) If the server skips sending ack packet then should the client retransmit till the server sends ack for the chunk?
Q5) Can we send the syn and ack packets separately? Or do we have to bundle both together?
Q6) Can we use two sockets?
Q7) a.Do we have to implement alternate control between the server and client? Like first the server sends message to client then client becomes server and message is sent? Or do we keep asking the client each time ' Do you want to receive or send data' ?
b. We are expected to implement bidirectional communication but in a sequential manner or in a simultaneous manner where both nodes in the network send each other data as they receive each other's data?
c. Do we have to provide input from the terminal for both nodes in the network? Or can we work with a few selected phrases?
Q8) We can create 2 files right? One for client and one for server
Q9) Should we actually implement in both ways ? Like Both server and client must send textmessages to one another and receive.And atlast it should print both messages alternatively?
Q10) can we put a limit for retransmissions ? MAX_RETRANSMISSIONS?
Q11) Is it okay if we hardcode the IP address?
Q12) Can we assume that if we are sending an ACK it is always recieved?
# General
Q1) we are allowed to change any file and any syscall already present in XV6 right?
Q2) Will there be moss for this mp?
Q3) The latest version of XV6 does not have the schedulertest command required for the report. What should we do in this case?
Q4) How do you debug xv6?