Forward proxy and reverse proxy difference?
Forward and reverse proxy agent essentially on behalf of a transceiver requests and responses.
Forward proxy is a proxy server located between the client and the target server. In order to obtain the content from the origin server, the client sends a request to the proxy server, and the target server, then the proxy server to transmit to the target and the obtained content back to the client. The client must be some special settings to use the forward proxy case.
Reverse proxy just the opposite. For the client, the reverse proxy if the target server, and the client does not require any setup. The client sends a request to the reverse proxy, then reverse proxy to determine where the request and the request is forwarded to the client, so that the content is like, like himself, so the client does not perceive the reverse proxy services back , clients do not need to do any settings, just need a reverse proxy server as a real server just fine.
Forward proxy hides the client. (Access Google's ladder)
Reverse proxy server hides. (Load balancing, access the intranet server)
References:
Why reverse proxy called reverse proxy?
Processes, threads, coroutines?
process
Refers to the process of executing a program, the system is the smallest unit of resource allocation, a process generally consists of the following components:
- Program code (referred to as text segments or code segments)
- Current activity (including a program counter, register contents)
- Data segment (including global variables)
- Stack (including function parameters, returns the temporary address parameters and local variables, etc.)
- (Dynamic allocation of memory to run during the process) heap
Process features:
- Dynamic: results from the creation process, executed by the scheduling, due to lack of resources suspended, revoked by the demise.
- Concurrency: multiple processes can run simultaneously over a period of time.
- Independence: the process is the basic unit independently.
- Asynchronous: the process each can be independently, to advance to the unknown speed.
Thread
Thread, also known as lightweight processes, is a running thread in the process, the actual implementation of those procedures, a process that contains at least one main thread, you can have more child threads.
- Using the CPU base unit, by the thread ID, the program counter, a register set and stack components.
- Snippet threads share the process of the same process, data and other resources.
Thread features:
- High response: a blocking thread in a process does not result in blocking the whole process.
- Resource sharing: multiple threads belong to a process of sharing all the resources of the process.
- Communication is simple:
- Fewer resources spent to create threads, thread switching process less resources than required to switch: the economy.
- Using a multi-processor architecture: CPU may utilize a plurality of executing multiple threads to achieve concurrent processing.
On the operating system, the thread is the smallest unit of execution, the process is the smallest unit of resource management.
Whether process or threads, are managed by the operating system.
Coroutine
Coroutine, English Coroutines, is a more lightweight than threads exist. As a process can have multiple threads, like a thread you can have multiple coroutines.
Coroutine is not managed by the operating system kernel, and is completely controlled by the program (i.e. in user mode execution).
References:
The difference between heap and stack memory
Single-core CPU and multi-core CPU, processes and threads running concurrently?
Goroutine system knowledge behind
Process scheduling algorithm
As shown above, there is a different process state, when a plurality of processes in the ready state, CPU scheduler process to select a CPU allocated to it.
Ready to decide which part of the process of selection is called the CPU scheduler to run the algorithm it uses is called the scheduling algorithm.
FCFS scheduling algorithm
The shortest job first algorithm
- Non-preemptive: When running process voluntarily giving up control of the CPU scheduling
- Preemptive:
- Scheduling process runs the shortest time to leave the initiative process CPU
- When the newly arrived process run time is less than the running processes remaining runtime scheduling time
Higher response than the first algorithm
Response ratio = (+ a desired waiting time of the processor service time) / desired service time
Round-robin algorithm
- Preemptive scheduling algorithm
- Clock every so often to generate an interrupt, process running into the ready state, with the first-come, first-served a selection process from the ready queue to perform
Priority Scheduling Algorithm
- Each process has a priority, the priority is not the highest priority scheduling process at the same time, the priority is the same first-come, first-served order scheduling
- Preemptive / non-preemptive
Multilevel queue scheduling
- The ready queue is divided into a plurality of separate queues
- Using priority scheduling between the various queues
- Using round-robin scheduling between the same priority
Multilevel feedback queue scheduling
- Preemptive algorithm
- A plurality of high to low priority queues
- Process just entered the system, enter RQ0, perform a complete time slice into RQ1
- It is the lowest priority queue in accordance with the round-robin scheduling method
Virtual Memory
It refers to the virtual storage system stores into memory only the part of the job to run the job.
It has transferred the request and function replacement function, a storage system from the expansion memory logic.
Request page storage management
- When a page is only partially transferred into memory process
- When the desired page is not in memory, the request transferred to the required page
- If insufficient memory, memory can be swapped out in a page to an external auxiliary storage
Page fault
Missing pages: page when the process of implementation to be accessed is not in memory
Missing page cause page fault: OS in response to a page fault, the required page into memory
Missing page replacement algorithm
- When a page fault occurs, OS be sure to select a page to call up the memory in memory for the page to be transferred to make room
- Page replacement algorithm responsible for selecting the page to be phased out
Optimal page replacement algorithm
- When a page fault occurs, there will be some will soon be accessed pages in memory, some have to wait for 100 or 1000 instructions to access to
- The number of instructions each page will have the next page to be accessed to be performed before tagging
- Page replacement algorithm eliminated the biggest mark
- This algorithm is optimal, but it can not be achieved.
FIFO replacement algorithm
- When a page fault occurs, the first to enter the memory page replacement
LRU replacement algorithm (Least Recently Used Least Recently Used)
Select the page the longest unused at the time of replacement
LRU algorithm to achieve: a timer
LRU algorithm to achieve: a doubly linked list
When access page Add this page to move to head
You do not need to look for when replaced, the replacement tail page
HTTP status code
classification | description |
---|---|
1** | Information , the server receives the request, the requester needs to continue operation |
2** | Successful operation has been successfully received and processed |
3** | Redirection , further action is required to complete the request |
4** | Client error , the request contains a syntax error or can not fulfill the request |
5** | Server Error The server error has occurred during the processing of the request |
Common status codes
status code | Status Code English name | Chinese description |
---|---|---|
200 | OK | Request succeeds, generally used for GET and POST requests |
320 | Found | Resource temporarily moved, the client should continue to use the original URI |
403 | Forbidden | The server understood the client's request, but refused to execute this request |
404 | Not Found | The server can not find the resources according to the client's request |
500 | Internal Server Error | Internal server error and can not fulfill the request |
502 | Bad Gateway | Gateway or proxy server attempts to execute the request, received from the remote server in response to an invalid |
References:
HTTP status code (novice tutorial)
The difference between HTTP and HTTPS
HTTPS feature
Confidentiality
Symmetric encryption, asymmetric encryption, encryption mixing
Integrity
Digest Algorithm
Authentication, non-repudiation
Digital signature (private key + digest algorithm)
References:
Time Geeks: Perspective HTTP protocol
database
index
Affairs
algorithm
Fibonacci number ---- some stairs n steps, each step can only be defined across one or two stages, the first n stairs to board there are several different moves?
String-to-digital (for example, string type 123, 123 should be after conversion of type int)
to sum up
Side probably experienced a 1.30 hours, the interviewer is in accordance with the basic skills involved in the project point in my resume to ask me, ask all the knowledge points are very shallow, is really very basic things, two questions before the three algorithms He said channel are thinking, I'm the last one to share a document Tencent let me hand and struck the code, the overall degree of difficulty are simple.