Supercharge Your Innovation With Domain-Expert AI Agents!

Method and system for acquiring inner core jiffies from user mode program

A user-mode, kernel technology, applied in the computer field, can solve the problems of user-mode program performance and low efficiency, and achieve the effect of eliminating frequent calls, saving time, and improving system performance.

Active Publication Date: 2014-07-02
OPZOON TECH
View PDF6 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] Existing user-mode programs need to obtain the reference time through the time or local time programming interface, but these interfaces will generate system calls. If the time is obtained frequently, the performance and efficiency of the entire user-mode program will become extremely low

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and system for acquiring inner core jiffies from user mode program
  • Method and system for acquiring inner core jiffies from user mode program

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0031] The embodiment of the present invention proposes a method for a user state program to obtain kernel jiffies, see figure 1 , including the following steps:

[0032] Step 101: Apply for a block of memory in the kernel to store the value of the kernel global variable jiffies, set the starting address of the memory as kmem, and whenever the kernel is interrupted by a clock, the value of jiffies will be increased by 1, and whenever jiffies changes , the kernel will write the value of jiffies to kmem.

[0033] In this step, apply for a piece of memory in the kernel through the kernel function kmalloc in the kernel. This memory is used to store the kernel global variable jiffies. The kmalloc function returns the memory start address kmem. Whenever a clock interrupt occurs in the kernel, jiffies The value of jiffies is increased by 1, and whenever jiffies changes, the kernel writes the value of jiffies to kmem.

[0034] Step 102: The kernel converts the virtual start address ...

Embodiment 2

[0044] Embodiment 2 of the present invention also proposes a system for user state programs to obtain kernel jiffies, see figure 2 , the system includes a kernel module 201 and a user mode module 202, wherein,

[0045] The kernel module 201 is used to apply for a block of memory in the kernel to store the kernel global variable jiffies. The starting address of the memory is set to kmem. Whenever a clock interruption occurs in the kernel, the value of jiffies is increased by 1. Whenever jiffies changes, The kernel just writes the value of jiffies into kmem; the kernel converts the virtual start address kmem of the memory into the physical start address kphy;

[0046] The user state module 202 is used to obtain the physical start address kphy of the memory, convert the physical start address kphy of the memory into the virtual start address uvir used by the user state program, and read the virtual start address uvir, get the value of the kernel global variable jiffies stored i...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a method for acquiring an inner core jiffies from a user mode program. The method is characterized by including the following steps that firstly, a memory is applied for in an inner core and used for storing the numerical value of the inner core global variable jiffies, the initial address of the memory is set as kmem, 1 will be added to the numerical value of the jiffies every time when clock interrupt of the inner core happens, and the numerical value of the jiffies will be written into the kmem by the inner core as long as the jiffies changes; secondly, the virtual initial address kmem of the memory is converted to a physical initial address kphy by the inner core; thirdly, the physical initial address kphy of the memory is acquired through the user mode program; fourthly, the physical initial address kphy of the memory is converted to a virtual initial address uvir adopted by the user mode program by the user mode program; fifthly, the numerical value of the inner core local variable jiffies stored in the kmem address by the inner core is acquired by the user mode program by reading the virtual initial address uvir. By means of the method, the inner core jiffies can be quickly and conveniently acquired from the user mode program, and accordingly system time can be quickly acquired.

Description

technical field [0001] The invention relates to the technical field of computers, in particular to a method and a system for obtaining kernel jiffies by a program in a user mode. Background technique [0002] The Linux kernel has a global variable called jiffies which represents the number of time ticks since the machine was started. This variable is initially initialized to 0 and is incremented by 1 each time the clock is interrupted. The kernel presets the frequency of the system timer (tick rate) by programming. Each cycle is called a beat. The core frequency is usually 1000Hz, which is 1000 beats per second. Time and relative time can be calculated by jiffies and tick rate. For example, the time period of 2 seconds can be expressed as 2*tick rate, then the time after two seconds can be expressed as jiffies+2*tick rate, it can be seen that the current time and the time after N seconds can be reached through jiffies, so that Provides a benchmark time that can be accurat...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/48
Inventor 李鹏
Owner OPZOON TECH
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More