Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the ulimit command in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what is the use of the ulimit command in Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the use of ulimit command in Linux" this article.

Linux common commands ulimit commands are used to restrict system users' access to shell resources.

Ulimit controls the resources of the shell program

Add that if you don't know what it means, the following paragraph can help you understand:

Suppose there is such a situation, when 10 people log in at the same time on a Linux host, in the case of unlimited system resources, these 10 users open 500documents at the same time, and suppose that the size of each document is 10m, then the memory resources of the system will be greatly challenged.

The actual application environment is much more complex than this assumption. For example, in an embedded development environment, all aspects of resources are very scarce, and there are very strict requirements for the number of open file descriptors, allocation stack size, CPU time, virtual memory size, and so on. The reasonable limitation and allocation of resources is not only a necessary condition to ensure the availability of the system, but also closely related to the performance of the software running on the system. At this time, ulimit can play a big role, it is a simple and effective way to achieve resource constraints.

Ulimit is used to limit the resources consumed by the shell startup process, supporting the following types of restrictions: the size of kernel files created, the size of process data blocks, the size of files created by Shell processes, the size of memory locks, the size of resident memory sets, the number of open file descriptors, the maximum size of the allocation stack, CPU time, the maximum number of threads per user, and the maximum virtual memory that can be used by Shell processes. At the same time, it supports the limitation of hard resources and soft resources.

As a temporary restriction, ulimit can act on shell sessions logged in by using its commands, ending the restriction when the session terminates, without affecting other shell sessions. For long-term fixed limits, ulimit command statements can be added to files read by login shell, acting on specific shell users.

Syntax ulimit (option) option-a: displays the current resource limit setting;-c: sets the maximum value of the core file in blocks;-d: the maximum value of the program data section area, in KB;-e default process priority, the smaller the value, the higher the priority-f: the largest file that shell can create, in chunks -H: set the hard limit of resources, that is, the limit set by the administrator;-m: specify the upper limit of available memory (in KB;-n): specify the maximum number of files that can be opened at a time;-p: specify the size of the pipe buffer (in 512 bytes);-s: specify the upper limit of stack (in KB;-S): set the elastic limit of resources -t: specify the upper limit of CPU usage time (in seconds);-u: the maximum number of programs that users can open;-v: specify the upper limit of available virtual memory (in KB). The maximum value of the instance [root@localhost ~] # ulimit-a core file size (blocks,-c) 0 # core file is 100 blocks. The data segment of the data seg size (kbytes,-d) unlimited # process can be arbitrarily large. Scheduling priority (- e) 0 file size (blocks,-f) unlimited # files can be arbitrarily large. Pending signals (- I) 98304 # has up to 98304 signals to be processed. Max locked memory (kbytes,-l) 32 # the maximum physical memory locked by a task is 32KB. Max memory size (kbytes,-m) unlimited # the maximum resident physical memory of a task. Open files (- n) 1024 # A task can open up to 1024 files at the same time. The maximum space for pipe size (512 bytes,-p) 8 # pipes is 4096 bytes. The maximum message queue for POSIX message queues (bytes,-Q) 819200 # POSIX is 819200 bytes. The maximum stack for a real-time priority (- r) 0 stack size (kbytes,-s) 10240 # process is 10240 bytes. The CPU time used by the cpu time (seconds,-t) unlimited # process. Max user processes (- u) 98304 # the maximum number of processes (including threads) opened by the current user is 98304. Virtual memory (kbytes,-v) unlimited # does not limit the maximum address space of a process. There is no limit to the maximum number of files that file locks (- x) unlimited # can lock. The above is all the content of the article "what is the use of ulimit commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report