Tuesday, August 21, 2012

GMAT Prep

Sample papers:


http://www.snapgmat.com/free-download.php
http://www.mba.com/store/product-info.aspx?ProductID=5035
http://www.mba.com/store/product-info.aspx?productid=5
http://www.platinumgmat.com/practice_gmat_questions/
http://www.800score.com/sample-gmat-questions.html
http://entrance-exam.net/gmat-papers/
http://www.testprepreview.com/gmat_practice.htm
http://gmat.learnhub.com/

http://gmat.learnhub.com/lesson/2420-welcome-to-gmat-preparation-free-gmat-resource




Friday, August 17, 2012

Job requirements

Books to get

  • Get  Steven Skiena's The Algorithm Design Manual

Google

  • Expertise in data structures, algorithms and complexity analysis.
  • Expertise in analyzing and troubleshooting large-scale distributed systems.
  • Knowledge of IP networking, network analysis and performance and application issues using standard tools such as tcpdump. 
  • Python
  •  
NetApp

  • experience with kernel internals programming
  • Unix/BSD/Linux/Windows.
  • File system knowledge
  • In depth knowledge of one or more core kernel functions
  • Virtual memory
  • Network protocol implementation
  • Resource allocation and management
  • File system implementation
  • Familiarity with one or more common file system architectures:
    • ext2/3
    • FFS/UFS
    • NTFS
    • btrfs/ZFS
 Reference
  •  topcoder
  • Google Code Jam
  • Facebook Hacker Cup

Friday, June 8, 2012

Shell scripting


Linux Kernel

  • Allocate memory in driver
  • what is IRQ? how will you register your IRQ no? Are you sure you willget the IRQ no you have requested? What if you don't get?
  • Difference bet insmode and modprobe
  • list currently available drivers
  • How to access userspace memory from kernel
  • Where will you place filesystem? above device driver or below it?
  • What is the use of file->private_data in a device driver structure ?
  • What are the two types of devices drivers from VFS point of view ?
  • What is the use of register_chrdev and unregister_chrdev ?
  •  How will you make interrupt handlers as fast as possible ?
  •   What are the types of softirqs ?
  •   Difference between Timer Softirq and Tasklet Softirq ?
  •   What are tasklets ? How are they activated ? when and How are they initialized ?
  •   What is task_struct and how are task states maintained ?
  •    When will you use rwlock instead of spinlock ?
  •   Can spinlock/rwlock be used in Interrupt handler ?
  •   Tell about the Memory Layout of a Process in Linux .
  •   How will you trace the system calls made into the kernel of lInux ?
  •   What is mmap ? MMAP & malloc ? MMAP & brk ? MMAP adv & dis-adv.
  •   Tell the relation between Malloc and MMAP
  •  Advantages of MMAP over Read ?
  •   Tell the role of brk() in malloc / Tell the relation between heap and brk?
  •  Example of using MMAP and MUNMAP in C ?
  •  Tell about the method/steps in Linux Kernel Compilation.
  •  What is Kmalloc and how does it differ from normal malloc ? or Why can't we use malloc in kernel code ?
  •   What happens as soon as a packet arrives from the network in Linux ?
  •  What is a stack frame, stack pointer & frame pointer ?
  •   What is a profiler ?
  •   How do you determine the direction of stack growth ?

Tuesday, May 22, 2012

C programming

Storage classes
  • Automatic
  • Static
  • Allocated

Volatile keyword
  • Prevents CPU optimizing the variable
  • Not atomic
  • Eg: variable pointing to hardware register,  system time

Register keyword
  • Normal memory access can be slow compared to cpu access. 
  • Compiler can decide what var to be stored in register at what time
  • Variable are kept in register - those that needs to be accessed often or access time is critical
Extern Variable
  • Variable defined outside any function block
  • Defining - allocates memory for the variable
  • Declare - requires the variable be defined already in the memory
Extern function


Static variable 
  • Scope same as auto variable
  • Storage is kept permanent as long as the program is running
  • If defined in header file, each source file including it will have its own copy of the variable
Memory segment



Swap two variables without using a temp variable

a = 5
b = 3

a = (a+b);
a=8
b = a-b;
b=5;
a= a-b;


Can a variable be const and volatile
Yes. The const modifier implies that this particular program code cannot change the value of the actual variable, but that will not imply that the value can not be changed by means outside this code by hardware


Difference between calloc and malloc
  • Calloc allocates block of memory each of certain size and inits it to 0. 
  • Malloc allocates certain bytes of memory
Why use C for embedded system

Difference between exit and return
  • Return - returns call to the calling function
  • Exit - exit out of the program and return control to the operating system 
  



Operating system


  • Microkernel
  • Difference between microkernel monolithic kernel
  • Process Control block
  • How do you unblock sockets
  • What is a system call? why do we need system call?
  • Memory segment when a process/program is executed
    • Data Segment
      • Data
      • BSS
      • Heap
    • Stack
    • Code segment
  • Mapping physical memory to virtual memory
  • Paging
  • Process and threads
    • Where to use process and thread
    • Scheduling threads
    • Mutex
    • Semaphore
  • IPC
    • Pipe
    • Message queus
    • Shared memory
    • Signals
    • Message queues
  • Process Daemon
  • Fork 

Reference:

http://lwn.net/Articles/250967/
http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/index.html
Cache - http://ecee.colorado.edu/~ecen2120/Manual/caches/cache.html 

NETWORKING


- What is core router and Edge router?

OSI Layers

  • Physical 
  • Data 
  • Network
  •  Transport 
  • Sesssion 
  • Presentation 
  • Application
What happens when you type an url?

This pretty much covers the basics of all major networking concepts.  Will go through layer by layer and get some insight



- DNS: get the server address resolved from the website address (This can be taken from browser cache, if not present, make a system call to the OS to get from OS cache, then to router and then to the ISP)


Application  layer 
Layer where the end user actually interacts with the software
Protocols:   HTTP , FTP

Quick things  to know about HTTP :
- Works on request reply model
- GET POST are the commonly used http requests
- HTTP cookies are used 
- Uses TCP protocol


Presentation Layer
Also called as syntax layer
  • Translation: Representation of data might be different in end user system. One end it might be mac, other end linux
  • Compression: To increase throughput
  • Encryption: Security reasons. Protocol used SSL . Encryption done in lower levels of protocol stack as well called IPSec
Session Layer 
The name of this layer tells you much about what it is designed to do: to allow devices to establish and manage sessions. In general terms, a session is a persistent logical linking of two software application processes, to allow them to exchange data over a prolonged period of time. In some discussions, these sessions are called dialogs; they are roughly analogous to a telephone call made between two people.

eg: Socket interface APIs used by transport layer
Transport Layer


Transmission Control Protocol
- Connection oriented - 3 way handshake
- Reliable transmission - order transmission using the sequence number field.
- Flow control - sliding window protocol
- Congestion control - ack, timers
- MSS - set according to MTU so that fragmentation is avoided, path MTU discovery is used to set the MSS accordingly.



TCP Header


TCP Connection - 3 way handshake




TCP Connection close





Sliding Window Protocol




The TCP urgent pointer is used to push data out of band ahead of already sent data.

Textbook example for that would be a slow telnet session in which after sending many commands, you decide to abort the session or the command using a control character such as control-C.

If you do not use an urgent pointer, the control-C will have no effect since it will have to pend the processing of all of the previous commands.
Using urgent pointer, the control-C processing is done out of band BEFORE the other commands, and thus it can cancel them or the entire session.



UDP header


ICMP header



Network Layer

IPV4 header



IPV6 header



IPV4 and IPV6 header comparison


IPV4
IPV6
Header size – 20 bytes
Header size 40 bytes
Addresses 2^32
2^128
IP checksum
No IP checksum
32 bits aligned
64 bits aligned
Broadcast address
No broadcast (Use multicast)
NAT
No NAT
Network id/host id
Global routing prefix/subnet id/interface id






TCP Socket
UDP Socket


Endian Transformation
  • Big Endian -  First Byte is MSB, Last byte, LSB Network byte order -ppc
  • Little endian -  First Byte is LSB, Last byte is MSB - Intel processors
  • Convert a given ipv4 address from one endian form to another 





Server
Desktop
No
Graphic intensive applications
Higher Cache size

More varied cache

Multiple cores

Serveral hard drives configured to appear as a single disk- RAID (Redundant Array of Inexpensive Disks)
Single hard drive
RPM of disk is more – faster

Hot Swappable drives

Faster RAM

ECC RAM

Redundant power supplies

No monitor, keyboard, mouse. Managed via network
Managed via monitor, keyboard, mouse
1GB n/w interface, multiple n/w interface


 



Trunk Port - Carries multiple VLAN frames



References
www.tcpipguide.com

http://beej.us/guide/


http://i.dell.com/sites/content/business/smb/sb360/en/Documents/What-Is-a-Server.pdf

 

Data Structures


Types of Data Structures
  • Arrays
  • Linked list
    • Single
    • Double
    • Circular
  • Stack
  • Queue
  • Hash table
  • Trees and Graphs
    • Binary search tree

Array
Linked list

Dynamic array allocation requires effort. Need to use realloc
Dynamic allocation and de-allocation is easy
Entire array in stack or can be malloced and used in heap
Head in stack, ll in heap
Time to access any element is a constant
Time to access an element is related to how far it is located from the head






ARRAY:
  • Contiguous space for same data type
  • Need to take care of buffer flow. Do a boundary check wherever required

LINKED LIST
  • Operations performed - add, delete, edit 
  • In a single linked list, the best place to add a new element is the head of the list.
  • Very important boundary condition is to check for empty  list case i.e head is null
  • How to reverse a single linked list.? 
Sample solution
Node * reverse( Node * ptr )
{
Node * temp;
 Node * previous = NULL;
 while(ptr != NULL) {
     temp = ptr->next;
     ptr->next = previous;
     previous = ptr;
     ptr = temp;
    }
 return previous;
 }

HASH TABLE 
  • Given a random set of data, hash table gives the optimum way to search for the data
  • perform hash function on the key to get the index
  • If multiple keys lead to the same index, we create a bucket with the index pointing a linked list of all possible entries. Parse through the linked list to fetch the desired entry
STACK:
  • LIFO
QUEUE:
  • FIFO
TREE:
Traversal methods
  • Pre order      RoLR
  • Inorder         LRoR
  • Post order      LRRo
Search Methods
  • BFS
  • DFS