Skip to main content

What is the difference between concurrency and parallelism? What is the difference between a large kernel and a micro kernel? What is the difference between a time-sharing system and a real-time system?What is the difference between static link and dynamic link?What are the stages of compilation?

 What is the difference between concurrency and parallelism?

Concurrency means that multiple tasks will be processed within a period of time; but at a certain moment, only one task is executing. Single-core processors can achieve concurrency. For example, there are two processes A and B. After A runs for a time slice, it switches to B, and B runs for a time slice and then switches to A. Because the switching speed is fast enough, the macroscopically shows that multiple programs can be run at the same time within a period of time.

Parallel means that there are multiple tasks being executed at the same time. This requires a multi-core processor to complete, and multiple instructions can be executed at the same time at the microscopic level. Different programs are run on different processors. This is a physical process of multiple processes at the same time.

 

What is the difference between a large kernel and a micro kernel?

The big kernel is to put all the functions of the operating system into the kernel, including scheduling, file system, network, device driver, storage management, etc., to form a tightly connected whole. The advantage of a large kernel is its high efficiency, but it is difficult to locate bugs and has poor scalability. Every time a new function needs to be added, the new code must be recompiled with the original kernel code.

The microkernel is different from the monolithic kernel. The microkernel just adds the core functions of the operation to the kernel, including IPC, address space allocation and basic scheduling. These things are all running in the kernel mode, and other functions are called by the kernel as modules. Run in user space. The microkernel is easier to maintain and expand, but the efficiency may not be high because it needs to switch frequently between the kernel mode and the user mode.

 

What is the difference between a time-sharing system and a real-time system?

The sharing time system is the system that divides the CPU time into short time slices and allocates them to multiple jobs in turn. Its advantage is that it can guarantee a sufficiently fast response time for multiple operations of multiple users, and effectively improves the utilization of resources.

Real-time system is the system's ability to process and respond to externally input information within a specified time (deadline). Its advantages are the ability to process and respond in a centralized and timely manner, high reliability, and safety.

Usually the computer uses time sharing, that is, sharing the CPU between multiple processes/users to achieve multi-tasking. The scheduling between users/processes is not particularly accurate. If a process is locked, more time can be allocated to it. The real-time operating system is different. Software and hardware must comply with strict time limits, and processes that exceed the time limit may be directly terminated. In such an operating system, each lock requires careful consideration.

 

What is the difference between static link and dynamic link?

Static linking means that during compilation, the static library is integrated into the application by the compiler and linker, and made into object files and executable files that can operate independently. The static library is generally a collection of some external functions and variables.

The static library is very convenient, but if we just want to use a certain function in the library, we still have to link all the content into it. A more modern approach is to use shared libraries, which avoids a lot of duplication of static libraries in files.

Dynamic linking can be executed when it is first loaded, or it can be completed when the program starts to execute. This is done by the dynamic linker. For example, the standard C library (libc.so) is usually dynamically linked, so that all programs can share the same library instead of being packaged separately.

 

What are the stages of compilation?

Preprocessing stage: processing preprocessing commands beginning with #;

Compilation stage: translate into assembly files;

Assembling stage: Translating the assembly file into a relocatable object file;

Link stage: Combine the relocatable object file and the separately precompiled object files such as printf.o to obtain the final executable object file.

 

Comments

Popular posts from this blog

8 common methods for server performance optimization

  1. Use an in-memory database In-memory database is actually a database that puts data in memory and operates directly. Compared with the disk, the data read and write speed of the memory is several orders of magnitude higher. Saving the data in the memory can greatly improve the performance of the application compared to accessing it from the disk. The memory database abandoned the traditional way of disk data management, redesigned the architecture based on all data in memory, and made corresponding improvements in data caching, fast algorithms, and parallel operations, so the data processing speed is faster than that of traditional databases. Data processing speed is much faster.       But the problem of security can be said to be the biggest flaw in the memory database. Because the memory itself has the natural defect of power loss, when we use the memory database, we usually need to take some protection mechanisms for the data on the memory in advance, such...

Recursion-maze problem - Rat in the Maze - Game

  package com.bei.Demo01_recursion; public class MiGong {     public static void main(String[] args)  {         //First create a two-dimensional array to simulate the maze         int [][]map=new int[8][7];         //Use 1 for wall         for (int i = 0; i <7 ; i++) {             map[0][i]=1;             map[7][i]=1;         }         for (int i = 0; i <8 ; i++) {             map[i][0]=1;             map[i][6]=1;         }         //Set the bezel         map[3][1]=1;         map[3][2]=1;         //Output         for (int i = 0; i <8 ; i++) {             for (int j = 0; j ...

AirBnB Infographic Journey to IPO

  Full Post at  https://techpomelo.com/2020/10/infographics-airbnb-milestone-journey-to-ipo/