- Cores v/s Virtual CPUs | Physical CPUs v/s Logical CPUs
How to - CPU info on linux and mac
Check if Hyper-threading is supported and enabled
- SRAM v/s DRAM
https://www.wikiwand.com/en/Static_random-access_memory
- L1 cache is divided into L1d(for data) and L1i(for instructions)
https://www.wikiwand.com/en/CPU_cache
pstree
starts withsystemd
and notinit
https://askubuntu.com/questions/844031/why-doesnt-pstree-command-show-init-in-ubuntu-16-04-lts
https://www.tecmint.com/systemd-replaces-init-in-linux/
- Process with pid 0
https://unix.stackexchange.com/questions/83322/which-process-has-pid-0
- PCI (Peripheral Component Interconnect)
https://www.techwalla.com/articles/what-is-a-pci-device
Memory Controller is a PCI device
-
VmSize and VmRSS
http://careers.directi.com/display/tu/Understanding+and+optimizing+Memory+utilization
Is VmRSS from /proc/pid/status a good indicator of memory usage? - Reddit
-
This is my take on how syscall works in xv6 and how you should implement one. All these are hypothesis from the experiments I did:
- The function exposed to the user is in
user.h
(saymy_syscall
) usys.S
tells the OS which function calls to make into a system call, so this has to be the same as the function exposed to the user (SYSCALL(my_syscall)
)- When compiling, the OS looks in
syscall.h
for getting the syscall number for it. It looks for the value ofSYS_my_syscall
which is#define
d. TheSYS
appended is probably for convention. - In
syscall.c
, this number is mapped to a function which will be used to extract arguments to the syscall from the stack and perform checks on them. We can call this function anything (saygetargs_my_syscall
). If we followed convention, we would've named itsys_my_syscall
but you know I like breaking rules. - We'll define the function in a separate file
sysfile.c
, so we'llextern
the functiongetargs_my_syscall
. Note that since we don't know the arguments yet, this function will take no arguments. The linker links the object files ofsysfile.c
andsyscall.c
(We tell it to do that in theMakefile
), so everything works out. getargs_my_syscall
will get the arguments and call the implementation of this syscall (sayimplement_my_syscall
). Again we could've named it anything! This function will take the same arguments we gavemy_syscall
(if you writegetargs_my_syscall
correctly that is).- The function definition of
implement_my_syscall
is to be placed indefs.h
so thatsysfile.c
can find it. - Implement
implement_my_syscall
- Make proper changes to
Makefile
for proper compilation. - Also note that the return value is integer always. It is usually used to test whether the syscall was successful or not. If you want to set a variable using the syscall, send a pointer to it as a parameter and then set that in the function.
- The function exposed to the user is in
-
**Note: ** xv6 does not have
free
, so generally avoid usingmalloc
since memory leaks. Seeumalloc
rather. -
malloc()
is a C library function and not a system call.