Supercharge Your Innovation With Domain-Expert AI Agents!

A method and system for obtaining kernel jiffies by a user-mode program

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

Active Publication Date: 2017-11-28
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
  • A method and system for obtaining kernel jiffies by a user-mode program
  • A method and system for obtaining kernel jiffies by a user-mode program

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0031] An embodiment of the present invention proposes a method for obtaining kernel jiffies by a user-mode program, see figure 1 , including the following steps:

[0032] Step 101: Apply for a piece of memory in the kernel to store the value of the kernel global variable jiffies, set the starting address of the memory to kmem, every time a clock interrupt occurs in the kernel, the value of jiffies is incremented by 1, and whenever jiffies changes , the kernel writes the value of jiffies to kmem.

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

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

Embodiment 2

[0044] Embodiment 2 of the present invention also proposes a system for obtaining kernel jiffies by a user-mode program, 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 piece of memory in the kernel to store the kernel global variable jiffies, and the starting address of the memory is set to kmem. Whenever a clock interrupt occurs in the kernel, the value of jiffies is incremented by 1. Whenever jiffies changes, The kernel writes the value of jiffies to kmem; the kernel converts the virtual start address kmem of the memory to the physical start address kphy;

[0046] The user mode module 202 is configured 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 mode program, and read the virtual start address by reading the virtual start address uvir, get the value of the k...

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 present invention provides a kind of method that user mode program obtains kernel jiffies, it is characterized in that, this method comprises: S1. apply for a piece of memory in kernel, be used to deposit the numerical value of kernel global variable jiffies, set described memory starting address as kmem, whenever a clock interrupt occurs in the kernel, the value of jiffies is increased by 1, and whenever jiffies changes, the kernel writes the value of jiffies into kmem; S2. The kernel converts the virtual start address kmem of the memory into physical Start address kphy; S3. The user state program obtains the physical start address kphy of the memory; S4. The user state program converts the physical start address kphy of the memory into the virtual start address uvir that the user state program uses; S5 . The user state program obtains the value of the kernel global variable jiffies stored in the kmem address by the kernel by reading the virtual start address uvir. The invention can conveniently and quickly acquire kernel jiffies in a user state program, and then quickly acquire system time.

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 user state program. 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 incremented by 1 each time the clock is interrupted. The kernel presets the frequency of the system timer (ie tick rate) by programming, each cycle is called a beat, and the kernel 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 precisely measurable base time f...

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
Patent Type & Authority Patents(China)
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