Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/2818302.2818305acmconferencesArticle/Chapter ViewAbstractPublication PagessospConference Proceedingsconference-collections
research-article

Running application specific kernel code by a just-in-time compiler

Published: 04 October 2015 Publication History

Abstract

Kernel scripting is a technique to run an extension code in a script language in an operating system kernel. Conventional kernel scripting has two limitations. First, it affects an entire system and only privileged users are allowed to install a new script. This prohibits developers from running their own application-specific code in the kernel. Second, its performance is not sufficient for some time-sensitive applications. In this paper, we address these problems. Our system call scripting allows developers to run their own application-specific code in the kernel without the root privilege. Our system call scripting runs with less overhead because we use a Just-In-Time (JIT) compiler. To evaluate our idea, we ported the LuaJIT compiler into the FreeBSD 10.1 x86 kernel. We modified Memcached to use system call scripting that processes multiple UDP GET requests at a time. With one worker thread and under a high-load condition, we achieved a 33% reduction in the average response time and a 44% improvement in the throughput when the response value size was small.

References

[1]
B. N. Bershad, S. Savage, P. Pardyak, E. G. Sirer, M. E. Fiuczynski, D. Becker, C. Chambers, and S. Eggers. "Extensibility Safety and Performance in the SPIN Operating System". In: Proceedings of the Fifteenth ACM Symposium on Operating Systems Principles (SOSP '95). 1995, pp. 267--283.
[2]
R. H. Campbell and See-Mong Tan. "μChoices: An Object-oriented Multimedia Operating System". In: Proceedings of the Fifth Workshop on Hot Topics in Operating Systems (HotOS V). 1995, pp. 90--94.
[3]
Changes from NetBSD 6.0 to NetBSD 7.0. URL: http://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0_RC3/CHANGES.
[4]
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. "Efficiently Computing Static Single Assignment Form and the Control Dependence Graph". In: ACM Trans. Program. Lang. Syst. 13.4 (Oct. 1991), pp. 451--490.
[5]
D. R. Engler, M. F. Kaashoek, and J. O'Toole Jr. "Exokernel: An Operating System Architecture for Application-level Resource Management". In: Proceedings of the Fifteenth ACM Symposium on Operating Systems Principles (SOSP '95). 1995, pp. 251--266.
[6]
Brad Fitzpatrick and Anatoly Vorobey. Memcached - a distributed memory object caching system. URL: http://memcached.org.
[7]
FreeBSD's callout API. URL: http://www.freebsd.org/cgi/man.cgi?query=timeout&sektion=9.
[8]
Galen C. Hunt and James R. Larus. "Singularity: Rethinking the Software Stack". In: SIGOPS Oper. Syst. Rev. 41.2 (Apr. 2007), pp. 37--49.
[9]
Implement recvmmsg() and sendmmsg() system calls. URL: https://reviews.freebsd.org/rS279204.
[10]
Ingo Molnar. Syslets, generic asynchronous system call support. URL: https://lkml.org/lkml/2007/2/13/142.
[11]
Rajesh Nishtala, Hans Fugal, Steven Grimm, Marc Kwiatkowski, Herman Lee, Harry C. Li, Ryan McElroy, Mike Paleczny, Daniel Peek, Paul Saab, David Stafford, Tony Tung, and Venkateshwaran Venkataramani. "Scaling Memcache at Facebook". In: Proceedings of the 10th USENIX Conference on Networked Systems Design and Implementation (NSDI '13). 2013, pp. 385--398.
[12]
Mike Pall. The LuaJIT Project. URL: http://luajit.org.
[13]
Niels Provos and Nick Mathewson. libevent an event notification library. URL: http://libevent.org.
[14]
Mohan Rajagopalan, Saumya K. Debray, Matti A. Hiltunen, and Richard D. Schlichting. "Cassyopia: Compiler Assisted System Optimization". In: In 9th Workshop on Hot Topics in Operating Systems (HotOS IX). 2003, pp. 103--108.
[15]
recvmmsg - receive multiple messages on a socket. URL: http://man7.org/linux/man-pages/man2/recvmmsg.2.html.
[16]
sendmmsg - send multiple messages on a socket. URL: http://man7.org/linux/man-pages/man2/sendmmsg.2.html.
[17]
Livio Soares and Michael Stumm. "FlexSC: Flexible System Call Scheduling with Exception-less System Calls". In: Proceedings of the 9th USENIX Conference on Operating Systems Design and Implementation. OSDI'10. 2010, pp. 1--8.
[18]
Lourival Vieira Neto, Roberto Ierusalimschy, Ana Lúcia de Moura, and Marc Balmer. "Scriptable Operating Systems with Lua". In: Proceedings of the 10th ACM Symposium on Dynamic Languages (DLS '14). 2014, pp. 2--10.
[19]
Mingqiang Zhuang and Brian Aker. Memaslap - Load testing and benchmarking a server. URL: http://docs.libmemcached.org/bin/memaslap.html.

Cited By

View all
  • (2023)Towards Just-In-Time Compiling of Operating SystemsProceedings of the 12th Workshop on Programming Languages and Operating Systems10.1145/3623759.3624551(41-48)Online publication date: 23-Oct-2023
  • (2023)Automatic Kernel Offload Using BPFProceedings of the 19th Workshop on Hot Topics in Operating Systems10.1145/3593856.3595888(143-149)Online publication date: 22-Jun-2023

Recommendations

Reviews

Partha Pratim Das

Kernel scripting allows users to dynamically load and execute scripts in the kernel to modify the kernel behavior according to their demands. Existing kernel scripting approaches are mostly performance-intensive and allow only privileged users to install kernel scripts, which affect the entire system. Extending the implementation by Neto et. al. [1], the authors propose system-call scripting for all users (without root permission) based on Lua [2,3] (scripting extension language) in Linux and FreeBSD systems, where the host kernel invokes the in-kernel Lua interpreter to dynamically execute user-defined kernel extension scripts in application scope only, without affecting the entire system, using specific system calls. Lua's just-in-time (JIT) compiler is modified and used to reduce runtime overhead of the interpreter. Lua uses a stack to communicate with the application it is integrated into. To implement the application-scope extension, two system calls are provided to all users. One loads the required script (written using Lua based on existing system calls) into a newly created stack at runtime and returns a file descriptor pointing to it, and the second call uses this file descriptor and accepts application arguments from the user space to run the script, after which the result is stored on the stack's top, to be used by the application. An intermediate module is provided, through which the Lua scripts access kernel memory only after proper validation, for safe execution of scripts. For performance gain, the tracing LuaJIT compiler is modified to run in kernel space as a kernel loadable lightweight module that produces optimized native code for frequently used code-paths for the interpreter to reuse. The authors evaluated the approach successfully by scripting kernel extensions for the Memcached application [4], to allow multiple transmissions of transmission control protocol/user datagram protocol (TCP/UDP) packets in one mode switch, and reported significant performance gain using the JIT compiler. The paper is well presented. The approach provides a high-level kernel programming environment and is useful for application developers with prior knowledge of Lua. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
PLOS '15: Proceedings of the 8th Workshop on Programming Languages and Operating Systems
October 2015
50 pages
ISBN:9781450339421
DOI:10.1145/2818302
  • Program Chair:
  • Shan Lu
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 October 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. JIT compilers
  2. Lua programming language
  3. kernel scripting
  4. scriptable operating systems
  5. system call scripting

Qualifiers

  • Research-article

Conference

SOSP '15
Sponsor:

Acceptance Rates

PLOS '15 Paper Acceptance Rate 7 of 16 submissions, 44%;
Overall Acceptance Rate 17 of 32 submissions, 53%

Upcoming Conference

SOSP '25
ACM SIGOPS 31st Symposium on Operating Systems Principles
October 13 - 16, 2025
Seoul , Republic of Korea

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 14 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Towards Just-In-Time Compiling of Operating SystemsProceedings of the 12th Workshop on Programming Languages and Operating Systems10.1145/3623759.3624551(41-48)Online publication date: 23-Oct-2023
  • (2023)Automatic Kernel Offload Using BPFProceedings of the 19th Workshop on Hot Topics in Operating Systems10.1145/3593856.3595888(143-149)Online publication date: 22-Jun-2023

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media