Friday, October 21, 2005

Veritas Interview Part II

I am just summing up some more qus which veritas asked me .. during all those technicle rounds ... Some of these were what i ans irrespective of whether they were asked or not :D

They told me that they just want my approach .. Even if my ans are incorrect.

here it goes ...

Q1. Would the TLBs be synchronized in SMP environment. And why.
Ans: I struggled and then said No. Obviously both CPU would get different set of instructions and there is not sense in syncronizing them.

Q2 How does computer boot up. ( I myself pulled the guy to this qus ).
This was interesting ..
Ans: Algo for x86
1. BIOS dos POST (some hardware checks) and Loads MBR (512Kb) at some fixed addr i think .. 0xfffffff0
2. sends RESET on the BUS. CPU starts execution from 0xfffffff0
3. lilo or whatever is loaded into MBR searches for Linux kernel's compressed image.
4. Loads kernel and the TRICK is.. that BIOS can only address physical addresses and even the CPU while booting knows only physical addresses (Since its registers like GDTR/LDTR and all are not set to traslate virtual-physical addresses)
At one point linux has to set the resgisters make CPU start executing in "protected mode" i.e 32bit virtaul addr. mode .. but since after that point the kernel execution path has to change coz kernel is %eip is poining to kernel code as per physical addresses. So before booting CPU into virtual addr mode .. kernel copies itself to another location from where execution would start when CPU comes to protected mode.

Q3. What do you call a daemon process. Who cleans up all the zombie processes.
Ans: Daemon is a program whose parent is already dead and init owns it now. And also it doesn't hold any tty/pts. Daemon is issentially a zombie process. And since it doesn't know if its parent would is dead .. its waiting for its parent to call wait on it. (Cos if parent calls wait and child is dead .. there would be kernel OOPs).

So init cleans all listed zombie processes.

Q4. What is cache snopping.
Ans: No idea ...

Q5. So if i say Its syncing the L1/L2 caches in SMP. So why and how is the done.
Ans: (I could only answered it when the guy asked me in second interview) You sync them coz in SMP even if the OS changes something in memory its no sure if the CPU is realy writing to the mem or just L1/L2 cache. This syncing is done through inter processor interupts. These interrupts can be raised writing to cr0 (control) register.

Q6. How are interrupts delivered to different CPUs in SMP.
Ans: APIC - advanced progm Inter. Contr. or something like that is persent in x86 (p3 onwards) you can program it to mask of some int. for some CPU. OR you can program it to give int. to CPU with lowest priority of task.

I dont know about 8259 or whatvere the int. controller was that in 386-P1.

Q7. Explain what is the layout of Ext2 filesystem.
Ans. Harddisk is divided into parts ( i dont know the actual term) and each part has itz own superblock, disk bitmap, inode bitmap, intode table , data blocks. Same copy of superblock is maintained by each segment so that if the first one gets corrupt then the others can be read and recovered. Bitmap cntains the bitmap of the data/inode. So 0 in bitmap would mean that corresponding block in the inode/data blocks is valid. It is used to quickly delete files.


Q8.How would you write a recursive function in assembly.
Ans: In normal functions you
push %ebp
mov %esp, %ebp .. so that you acn access the arguments pushed to the stack using %ebp
So Arg1 can be 8(%ebp) and Arg2 at 12(%ebp).
I told him about the recursive function .. The only trick there was that you needed to pop %ebp on every return and move %ebp into %esp.

Q9. How would you query for a graph in another graph. ( This he asked after i told him about Glassbox stuff).
Ans: Well given you have starting-points/root of the graph same you can identify the graph in O(n2) but if thats not give its a NP complete problem.


Finally i realised that they are just testing for basic skills ... I mean if these guys really wanted to screw me .. they could easily have.

Finally .. today i got the offer. Itz good. I am joining the filesystem group .. most probabbly the AIX/Linux team. This group has arround 35 dev members and most of them Phd. So wish me luck.

5 Comments:

Blogger Sandeep Kumar said...

Congrats for all..

and Thankx too . kabhi baad mein tere questions and answers kaam aa sakte hain :)

4:30 AM  
Anonymous Anonymous said...

kya baat hai yaar..phoda phadi machake rakhha hai....anyway, i hope u wud be the most happiest guy as u hv got core OS job...congrats....

6:10 AM  
Anonymous Anonymous said...

congrats daar .... phod diya tune to .... have a blast at the party!

7:39 AM  
Anonymous Anonymous said...

congrats man...really phod diya

5:07 PM  
Anonymous Anonymous said...

kyon be jassi itne bade phont mein kyon likha hai?

-garde

4:46 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home