Technical Questions

1.Difference between your two most confident languages? (i.e. Python and C/C++)


Difference between Python and C++:

  1. C++ is a statically typed, free-form, multi-paradigm and a compiled programming language. Python is a dynamically typed, script language, both compiled and interpreted. In Python, there is no need to declare types explicitly.
  2. Memory management, C++ use pointers and references, while Python uses Garbage Collection whereas C++ does not.

2.Difference between program, process and thread?


A Program is an executable file containing the set of instructions written to perform a specific job on your computer.

A Process is an executing instance of a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.

A Thread is the smallest executable unit of a process. A process can have multiple threads. Each thread will have their own task and own path of execution in a process.  All threads of the same process share memory of that process. As threads of the same process share the same memory, communication between the threads is fast.

Difference between process and thread.

The hierarchy relationship between program, process and thread.

Relationship between program, process and thread.

2.1. Why process can’t access other processes’ memory? Which CPU component is managing this? (MMU)


Each process in your zoo needs its own area of memory, as a place to run its code from and keep variables and results in. You can think of this set as consisting of a read-only code segment(containing the process’s instructions) and a writeable data segment(containing all the process’s variable storage). The data segment is truly unique to each process, but if two processes are running the same code Unix automatically arranges for them to share a single code segment as an efficiency measure.

Memory Management Unit, has the special ability to put fences around areas of memory, so an out-of-bound reference will be refused and cause a special interrupt to be raised.

Image result for cpu components

If you ever see a Unix message that says “Segmentation fault”, “core dumped” or something similar, this is exactly what has happened; an attempt by the running program to access memory (core) outside its segment has raised a fatal interrupt. This indicates a bug in the program code; the core dump it leaves behind is diagnostic information intended to help a programmer track it down.

2.2 How to send a signal to a process? (kill -9)

  1. Using kill command, for example, kill -s SIGNAME PID, test the capabilities of your programs and scripts under abnormal conditions by using kill to send a specific signal.
  2. From another process, Kill system call takes two arguments: 1) the PID (process id) of the process that needs to be signalled 2) the signal that needs to be send to the process.
  3. From keyboard, When a process is running on the terminal, you can send signal to that process from the keyboard by using some specific combination of keys. SIGINT (Ctrl + C) – You know this already. Pressing Ctrl + C kills the running foreground process. This sends the SIGINT to the process to kill it.

2.3. How to share variables between two processes? What about between two threads?


For two processes in Python:

  1. Queues
  2. Pipes


  1. Socket
  2. Semaphore (信号量)
  3. Message queue
  4. Signal

For two threads in Python:

Since threads can share memory in the same process, so the problem is about how to access memory safely? In Python, we can use:

  1. Lock
  2. Condition


3.1How do the father class (with abstract function?) call sub-class function? What happened to the compiler?

4.How does catch exception work in Unix / Linux? (stack waker)

Image result for stack waker

4.1 How is stack memory used in Linux? To save what kind of information?

Memory Allocation: Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer’s RAM.

Stack stores local data, return addresses, used for parameter passing. 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。

Heap is used on demand to allocate a block of data for use by the program. 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。

5. How will you explain recursion (to people who don’t have programming experience)?

6.What is abstract class? What are the use cases of abstract class?

7.How do you process large data? Find a key and it’s value in a large data?

8.What factors affect the price of a bond?