Tags: process address space simple color Like-o automatic Assignment Summary mem SSEExperiment: Understand the process of process scheduling and process switching during time tracking analysis processFirst, the experimental requirements? (1) Understanding the timing of process scheduling in Linux, you can search the kernel code for the schedule () function, see where the schedule () is called, to determine whether the summary of our course content is
find ways to save them, in order to efficiency, here will be prev saved in Registers in order to be used in the aftermath"Movl $1f,%1/n/t" * Save EIP///here, as long as the process has been switched out here will be labeled 1 as a return to the EIP"PUSHL%6/n/t" * Restore EIP/////////////////////////////////////////////////////////////// EIP loaded into the EIP register, in fact this jmp call to __switch_to is a manual call calls, very clever"
by the hardware context only if the method is saved differently)
2.Linux System General Execution processThe most common scenario: a running process x switches to the process of running process y
Running user-state process X
An interrupt occurred--save cs:eip/esp/eflags (current) to kernel Stack,then load Cs:eip (entry of a specific ISR) and SS:ESP (point to Kernel Stack).
Save_all//Save site
. The code is as follows:ENTRY (RET_FROM_INTR) get_current (%EBX) //Place a pointer to the TASK_STRUCT structure of the current process into the Register EBXMOVL eflags (%ESP),%eax# mix eflags and Csmovb CS (%ESP),%altestl $ (vm_mask | 3),%eax//see if the interrupt is in User state jne Ret_with_reschedule //assumed to be in user state, then run Ret_with_ RESCHEDULEJMP Restore_allRet_with_reschedule:cmpl $0,need_resched (%EBX)//View the contents of the TASK_STRUCT structure at need_resched jne
added before the operands of absolute transfer and call commands (jump/call), but not in Intel format.
6) The operation code of the remote Transfer Instruction and remote sub-call instruction is "ljump" and "lcall" in the att Assembly format ", in Intel assembly format, it is "JMP far" and "Call far", that is:Att format: ljump $ section, $ offset
Lcall $ section, $ offset
Intel format: Call far section: Offset
JM
. This amount of displacement is added to the IP register. The displacement amount is a signed number, negative numbers indicate a forward transition, and positive numbers indicate a backward transition. The transfer range is 32768 to +32767.Third, the indirect transfer ①jmp AX (intra-segment register indirect transfer); ②jmp [BX] (Intra-segment memory indirect transfer). Sends the contents of the specified
Linux services)It is important for Linux users. Disabling unnecessary services can make Linux run more efficiently, but not all Linux services can be disabled. After installing centos Linux today, we found that many services were started when
First, interrupt initialization1. Initialization of the interrupt vector table IDTvoid __init Init_irq (void) {int i; #ifndef Config_x86_visws_apicinit_isa_irqs (); #elseinit_VISWS_APIC_irqs (); #endif/* * Cover the whole vector space, no vector can escape * us. (Some of these would be overridden and become * ' special ' SMP interrupts) */for (i = 0; i For interrupt vectors from 0x20 to 224, set the interrupt handler, set_intr_gate as follows:void set_intr_gate (unsigned int n, void *addr) {_set
Linux-(2) Basic file operations in Linux, linux-linux
In linux, everything is files, directories are files, and hardware is files. Therefore, basic file operations are especially important.
1. List the contents of the directory:
Ls
Parameters:
-A: displays all files (includ
Logout Exit SystemGedit Text Editor ToolsUname–r View kernel version information, uname–a more detailsCat/proc/cpuinfo viewing CPUsCat/proc/meminfo Viewing memoryHostname Viewing host namesIfconfig eth0 view eth0 IP AddressAlias ls= ' ls–ll ' setting aliasesTo view the path of the current terminal: TTYView current Shell:echo $SHELLAll Shell:cat/etc/shells under the current systemView CentOS System hostname Format: Echo $PS 1Distinguish internal or external commands: Type CDWhich find the locatio
I. att format Linux Assembly syntax format
In att Assembly format, Register names must be prefixed with '%'. In Intel assembly format, Register names do not need to be prefixed. For example:
Att format
Intel format
Pushl % eax
Push eax
In att Assembly format, the prefix '$' is used to represent an immediate operand. In Intel assembly format, the representation of immediate numbers does not contain any prefix. For exa
.
As we all know,linux system everything is a file, so each process has its file descriptor, The Nginx process writes its own file descriptor to the Nginx.pid, and we need to tell Nginx to reopen a new log file (the configuration details of the log file can be seen here, simply by letting the log record what. So we need this directive:kill -USR1 `cat ${pid_path}`This instruction means: first cat to Nginx PID, is an integer, and then send the signal
that TR points to the new TSS, and the task switching is completed. The CPU can also implement task switching through the JMP and CALL commands. when the jump or CALL target segment actually points to a TSS description in the GDT table, a task switching will occur.
2. Linux task switching and field protection
?? Intel is well-designed for task switching and provides a simple task switching mechanism. Howev
Becoming a Senior Programmer proficient in Linux programming has always been the goal of many friends. According to statistics from chinacache, the monthly salary of Linux programmers in Beijing is 1.8 times that of Windows programmers, 2.6 times that of Java programmers, and 2.9 times that of Windows programmers. At the same time, the data shows that with the increase of work experience, the income gap bet
. System call access is a very frequently used process that can be used thousands of times per second, and its time efficiency is important. Moreover, the system call access process also involves the user space and system space between the switch, and for this purpose some instructions in the C language does not have the corresponding language components, so, the system calls to enter and return obviously must use assembly language to write.In some special occasions, the space efficiency of a pr
entry and return of system calls is a typical example. System call access is a very frequently used process that can be used thousands of times per second, and its time efficiency is important. Moreover, the system call access process also involves the user space and system space between the switch, and for this purpose some instructions in the C language does not have the corresponding language components, so, the system calls to enter and return obviously must use assembly language to write.
3.4 manage I/O port resources
We all know that the x86 processor using I/O ing implements a separate address space for the peripherals, that is, the "I/O space" (I/OOr "I/O port space". Its size is 64 KB (0x0000-0xffff ). Linux implements the concept of "I/O port space" on all platforms it supports.
Because I/O space is very small, even if the peripheral bus has a separate I/O port space, not all peripherals place their I/O Ports (registers) maps to "
This document copies the content of the following two documents: (1) "handling Linux kernel missing page exceptions using abnormal tables" http://www-128.ibm.com/#works/cn/linux/kernel/l-page/index.html; (2) "implementation and understanding of user/kernel space data replication" www.linuxforum.net.
The address ing of user processes is sometimes not established (such as a stack), and the page in pg_dir has
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.