Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, October 13, 2014

Multithreading

Hi,

Here are few possible queries that can be discussed about multithreaded programming in linux !

1. Can a child process be called as a thread ?
2. Are there multiple ways to create a thread ?
3. Is it possible for the thread to be alive if we terminate the process ? Is it possible for a child process to be alive if we terminate the parent process ? 
4. What is the memory layout of a process ?
5. What is the difference between multithreading and multiprocessing ?
6. What is the memory layout of a process with 2 threads ? What is the memory layout a process with 2 child process ?
7. If we declare a variable in the thread handler of 1st thread, will it be accessible accessible to 2nd thread ?
8. If we declare one variable locally in process and another globally in process, which one will be accessible to its threads ? Will those variable be available in child process also ?
9. Is it better to design a multi-threaded application or multi-process application ?
10. When should we need to go for multi-thread design and when should we go for a multi-process design ?
11. What is TLS ?
12. Who schedules the processes and who schedules the threads ?
13. Why process considered to be heavy weight ?
14. What are the contents of PCB ? What are the contents of TCB ?
15. How to ensure that thread1 gets terminated before thread2 ?
16. What will happen if we do not reap the zombie process ?
17. What is the use of zombie process ?
18. What are the various ways to terminate a zombie process ?
19. What is the difference between wait() and waitpid() system calls ?
20. Can two zombie process communicate with each other ?
21. How do you decide on the granularity of the lock ?
22. Is it good to have big lock or small lock ?
23. What will happen if a resource is improperly locked ?
24. What is atomicity ?
25. Where are atomic operations useful ?
26. What is spinlock ?
27. What is the use of PID ?
28. What is a process, thread ? What are the differences between process and thread?
29. If there are 2 sequential fork() calls, how many child process will be there ?
30. What is the use of reentrant function in multi-threaded environment ?
31. What is the advantage of using pthreads or POSIX threads ?
32. What are the various thread models and tell the scenario in which the particular thread model is useful / beneficial ?
33. What are the advantages & dis-advantages of 1:N user level threading (thread model)?
34. What is the difference between userspace threads and kernel space threads ?
35. Will a crash of a thread impact the other thread of the process ?
36. What is the difference between pthread_create() and fork() ?
37. What information is shared between a child process and the parent process ?
38. If a parent has 2 threads , will the child process also inherit or have a copy of those 2 threads ?
39. Why a faulty pointer does not crash a process but that of a thread can corrupt the process / other threads of the process ?
40. What is co-operative multitasking and what is pre-emptive multitasking ?
41. How do avoid race conditions in multi-threading
42. What will happen if you call a sleep() in a process or thread ?
43. Will a parent process be given higher priority compared to child process by the linux scheduler ?
44. What is vfork ?
45. What is the common mode of communication between a parent process and child process ? What are the modes of communication between threads ?
46.  Is child process light weight compared to parent process ?
47. What does a fork() call return ?
48. How to terminate a process by programming method ?
49. What are the software models for mulithreaded programming ?
50. What steps are performed during a context switch of a thread and what steps are performed during a context switch of a process ?

Sunday, June 5, 2011

Linux Filesystem

Hey all,
The following are the probable questions related to Linux Filesystem that can be discussed.

1. What is the need for Virtual Memory ?
2. What is the difference between the term 'Virtual Memory' and 'Virtual Address Space' ?
3. Can an user space application view the physical address Or Can an user space application access the physical address space ?
4. Is it possible for two different application to have a same virtual address but point to different physical memory ?
5. What are the functionalities performed by _start ?
6. What is the difference between Code section, Data section, ro Data section & BSS section ?
7. What is the expansion of BSS and What is the need for BSS ?
8. What is the size of the Kernel space and that of User space ? Who decides the size of it . Is it dependent/done by Processor or MMU ?
9. Tell one of the etry point to kernel ?
10. Explain the system call mechanism such that the flow is from User space to Kernel space & returning back to User space ?
11. What is the use of SYSENTER ? Does it get executed in Userspace ?
12. What is the use of SYSEXIT ? Does it get executed in Kernelspace ?
13. What is the role of __sys_open ?
14. What is the use of ABI (Application Binary Interface) document ? Who provides that manual ?
15. How do you see the size of an executable file in Linux ?
16. What is the probable size of normal vmlinux ? What kind of sizes have you come across in normal linux and embedded linux scenarios ?
17. What is vmlinux.lds ?
18. Why do you find all addresses to start after '0xC0000000' if you do 'readelf -a vmlinux' ? Can you access those addresses ?
19. What is a FDT (File Descriptor Table) ?
20. Explain the relation between File Descriptor table, Symbol File table, iNode table and harddrive/phy memory ?
21. What command is used to setup/create the relation between the device and inode ?
22. What command/API is used to create an inode for a file ?
23. What is the use of 'file_operations' ? How have you used it ?
24. What is the use of /proc/PID/maps ?
25. What is task_struct ?
26. Explain the relation between file struct,File Descriptor Table(FDT), task_struct, MM_struct, vm_area_struct, Heap, Page Global Directory(PGD), Page table(PT) & user page .
27. What is the use of ioctl fuction ?
28. Explain one level page table address translation between VA and PA with an example ?
29. Explain multi level page table address translation between VA and PA with an example ?
30. Is it better to have less level of page table address translation or more levels of page table address translation ? What is the impact on performance w.r.t memory size and memory access ?
31. What is the difference between malloc and vmalloc ?
32. What is PAE (Physical Address Extension) ?
33. What is Dual Mapping ? Can a user virtual address and kernel virtual address map to the same physical address ?

Monday, July 5, 2010

Linux and Linux Device driver

Linux is one of the very common Operating Systems and hope many would like to have some linux discussion. Here is a collection of questions for our linux and linux device driver related discussion...

1. What is the difference in features between kernel 2.2, 2.4 and 2.6 ?
2. What are Static and Shared libraries ?
3. What is dynamic linking ? What is static linking ?
4. What are the advantages of Dynamic linking or Shared libraries ?
5. Does gcc search for both static and shared libraries ? Which is searched initially by gcc compiler ?
6. What should be done for Shared library based linking in gcc ?
7. What should be done for static library based linking in gcc ?
8. What is object file and what are symbols ?
9. Can you tell the memory layout based on Data,BSS,HEAP and STACK ?
10. What are the ways in which linux kernel can be compiled ?
11. How will get the driver added into the kernel ? What are Kconfig files ?
12. What is a kernel module ?
13. What is the difference between insmod and modprobe ?
14. How will you list the modules ?
15. How do you get the list of currently available drivers ?
16. How will you Access userspace memory from kernel ? What are the various methods ?
17. What is the use of ioctl(inode,file,cmd,arg) ApI ?
18. What is the use of the poll(file, polltable) API ?
19. What is the use of file->private_data in a device driver structure ?
20. What is a device number ?
21. What are the two types of devices drivers from VFS point of view ?
22. What are character devices ?
23. How does the character device driver adds and remove itself from the kernel ?
What is the use of register_chrdev and unregister_chrdev ?
24. What is the role of interrupts in a device driver ? How are interrupts handled in device driver ?
25. How will you make interrupt handlers as fast as possible ?
26. What are the types of softirqs ?
27. Difference between Timer Softirq and Tasklet Softirq ?
28. What are tasklets ? How are they activated ? when and How are they initialized ?
29. What is task_struct and how are task states maintained ?
30. What is rwlock and spinlock ? Briefly explain about both of them ?
31. When will you use rwlock instead of spinlock ?
32. Can spinlock/rwlock be used in Interrupt handler ?
33. Tell about the Memory Layout of a Process in Linux .
34. How will you trace the system calls made into the kernel of lInux ?
35. What is mmap ? MMAP & malloc ? MMAP & brk ? MMAP adv & dis-adv.
36. Tell the relation between Malloc and MMAP
37. Advantages of MMAP over Read ?
38. Tell the role of brk() in malloc / Tell the relation between heap and brk?
39. Example of using MMAP and MUNMAP in C ?
40. Tell about the method/steps in Linux Kernel Compilation.
41. What is Kmalloc and how does it differ from normal malloc ? or Why can't we use malloc in kernel code ?
42. What happens as soon as a packet arrives from the network in Linux ?
43. What is a stack frame, stack pointer & frame pointer ?
44. What is a profiler ? Which one have you used ?
45. How do you determine the direction of stack growth ?

Friday, June 18, 2010

Linux kernel - I

The below queries can be used for our linux kernel discussion.

1. How are FLIHs and SLIHs termed in Linux ?
2. What is the main drawback for not considering Linux as realtime ?
3. What is the type of scheduler used in Linux Kernel 2.5 ?
4. What are the types of scheduler used in Linux Kernel 2.6 to 2.6.23 and after Linux kernel 2.6.23 ?
5. CFS scheduler in Linux is based on red-black tree - True / False ?
6. O(1) scheduler in Linux is based on run queues - True / False ?
7. Is the architecture of linux kernel monolithic / microkernel ?
8. How will you trace the system calls made into the kernel of lInux ?
9. Tell about the Linux Kernel Compilation method ?
10. What is 'make mrproper' and how is it different from 'make clean' ?
11. What is Kmalloc and how does it differ from normal malloc ? or Why can't we use malloc in kernel code ?
12. Does the scheduler assign a zombie state to a process ?
13. Brief up 'vmalloc' vs 'kmalloc' ?
14. Brief up 'malloc' vs 'kmalloc' ?
15. How modules begin and end in LInux ? Tell the difference between Modules and Program ?
16. What is mmap ?
17. What are the advantages of mmap over read ?
18. Most of Unix kernels are monolithic - True / False ?
19. Why is microkernel slower than monolithic kernel ?
20. What are the advantges of microkernel over monolithic kernel ?
21. What is a 'Module' ?
22. What are the main advantages of using a 'Module' ?
23. Once linked in, the object code of a 'module' is equivalent to the object code of the statically linked kernel - True / False ?
24. What are the limitations of hard links / What are advantages of soft links ?
25. Unix Kernels are Reentrant - True / False ?
26. What is Kernel Control Path ?
27. What is the drawback in using semaphore for synchronization ? How does spinlock help in overcoming it ?
28. What does a semaphore consist of ? and What does a spinlock consist of ?
29. Why spinlocks are useless in uniprocessor systems ?
30. What are the two kinds of system events ?

Tuesday, June 8, 2010

Boot loader

Here are boot loader related questions that are of great interest and that can be used for our discussions.... Check it out !

1. What are the various boot loaders that you have worked on ?
2. Where is the boot loader present in an embedded system design ?
3. In general, what does the boot loader do ?
4. What is the role of boot loader in embedded systems ?
5. How will you handle a scenario in which the boot software is erased/corrupted ?
6. How will you handle boot software erasure/corruption scenario if Boot ROM is not available ?
7. What do you mean by bootstrap loader and what does it do ?
8. Is booting different from bootstrapping ?
9. When the computer is powered ON, it does not have OS it in neither ROM nor RAM - True/False ?
10. What is a second-stage boot loader ?
11. Do LILO/GRUB/Syslinux belong to either first stage boot loader(small program) or second-stage boot loaders ?
12. What is network booting ?
13. What is Chain loading or Multi-stage boot loader ?
14. Can you brief up the boot sequence of a normal desktop computer ?
15. Tell about OMAP CPU booting ?
16. What are the most common boot modes of DSP processor ?
17. Give few examples for systems that use Host Port(HPI Boot) for DSP booting ?
18. How will you put U-Boot into the target board ?
19. TFTP is a stripped down version of FTP that does not require authentication - True/False ?
20. Why do you need 2 stage boot process in OMAP processor ?
21. Can you give a highlevel view of Linux Boot process ?
22. What is the role of MBR and its relation with BIOS ?
23. Where is the MBR located ?
24. What is the structure of MBR ?
25. The secondary, or second-stage, boot loader could be more aptly called the kernel loader - True / False
26. What is the relation between GRUB and filesystem while booting ? or Main Difference between LILO and GRUB ?
27. What is the difference between zImage and bzImage ?
28. What is the role of initrd/Initial RAM disk ?
29. What is the role of initrd/Initial RAM disk in Embedded systems ?
30. Can you tell about the major function-level flow for Linux i386 booting ?
31. Does GRUB involve a 3-stage boot loading ? If yes, what are they . Brief it ?

Hope this list will help in equipping yourself for few of major interview questions related with boot loaders :-)