Dev shm in linux

Записки системного программиста

Некоторые проекты

суббота, 11 октября 2008 г.

Что такое /dev/shm?

Если в своей Linux системе вы посмотрите на вывод команды mount, то в одной из строк скорее всего вы увидите что-то вроде:

Многие знают, что такое tmpfs, и даже используют эту файловую систему размещающую данные в памяти (например, монтируя ее в /tmp), но наверняка не многие знают зачем она смонтирована именно в /dev/shm? Что за странное место для временного хранилища?

Название /dev/shm наводит на мысль о механизме межпроцессного взаимодействия IPC shared memory. Но нетрудно убедиться, что для привычного System V IPC эта файловая система не требуется. Вызов shmget, например, не обращается к файловой системе, пространство имен поддерживается ядром. Так зачем /dev/shm? Оказывается, в glibc, кроме System V shared memory IPC есть реализация POSIX IPC. И вот эта реализация и использует /dev/shm. Убеждаемся в этом:

6 комментариев:

почему нет ни одного коммента? отличный пост, спасибо!

Спасибо! Коротко и ясно.

Зачем пустой #include? Если не нужен, то можно его вообще опустить. Без инклудинга компилит нормально.
PS: Считаю, что критика это хорошо — она помогает достичь совершенства 🙂

Ой, а у нас на /dev/shm 16 гиг свободно! Можно я туда бекапы положу?

Источник

Когда следует использовать /dev /shm /, и когда следует использовать /tmp /?

Когда мне следует использовать /dev/shm/ и когда я должен использовать /tmp/ ? Могу ли я всегда полагаться на них как на Unices?

6 ответов

/dev/shm — временная файловая система хранения файлов, т. е. tmpfs , которая использует ОЗУ для хранилища резервных копий. Он может функционировать как реализация общей памяти, которая облегчает IPC .

Недавние версии 2.6 Linux kernel builds начали предлагать /dev /shm в виде разделяемой памяти в виде ramdisk, более конкретно, как каталог, записываемый в мире, который хранится в памяти с определенным пределом в /etc /default /tmpfs . Поддержка /dev /shm полностью необязательна в файле конфигурации ядра. . Он включен по умолчанию в дистрибутивах Fedora и Ubuntu, где он наиболее широко используется приложением Pulseaudio. â € â € ƒâ € ƒâ € ƒâ € ƒâ € ƒâ € ƒâ € ƒâ € ƒ â € â € â € ƒ ƒ (добавлен акцент)

/tmp — это место для временных файлов, как определено в Стандарт иерархии файловой системы , за которым следуют почти все дистрибутивы Unix и Linux.

Поскольку оперативная память значительно быстрее, чем дисковое хранилище, вы можете использовать /dev /shm вместо /dev/shm для повышения производительности , если ваш процесс интенсивный ввода-вывода и экстенсивно использует временные файлы.

Чтобы ответить на ваши вопросы: Нет, вы не всегда можете полагаться на /tmp , а не на машины, привязанные к памяти. Вы должны использовать /dev/shm , если у вас нет оснований для использования /tmp .

Помните, что /dev/shm может быть частью файловой системы /tmp вместо отдельного монтирования и, следовательно, может расти по мере необходимости. Размер / ограничен избыточным ОЗУ в системе, и, следовательно, у вас скорее всего будет нехватка места в этой файловой системе.

В порядке убывания tmpfs вероятность:

Поскольку вы задаете вопрос о конкретной точке монтирования Linux tmpfs для Linux в сравнении с портально определенным каталогом, который может быть tmpfs (в зависимости от вашего sysadmin и того, что по умолчанию для вашего дистрибутива), ваш вопрос имеет два аспекта, которые другие ответы подчеркивали по-разному:

  1. Когда использовать эти каталоги на основе хорошей практики
  2. Когда целесообразно использовать tmpfs

Передовой опыт

Консервативное издание (см. условные обозначения из FHS и обычное использование):

  • В случае сомнений используйте /tmp .
  • Используйте /var/tmp для больших данных, которые могут не легко помещаться в ram.
  • Используйте /var/tmp для данных, полезных для перезагрузки (например, кеша).
  • Используйте /dev/shm как побочный эффект вызова shm_open() . Предполагаемая аудитория — это ограниченные буферы, которые бесконечно перезаписываются. Так что это для долговечных файлов, содержимое которых неустойчиво и не очень велико.
  • Если вы все еще сомневаетесь, предоставьте пользователю возможность переопределить. Например, программа mktemp удовлетворяет переменной среды TMPDIR .

Используйте /dev/shm , когда важно использовать tmpfs, /var/tmp , когда это важно не делать, else /tmp .

Где tmpfs превосходит

fsync — нет-op на tmpfs. Этот syscall является врагом номер один (производительность IO) (и долговечность вспышки, если вам это интересно), хотя если вы обнаружите, что используете tmpfs (или eatmydata ), чтобы победить fsync, тогда вы (или какой-либо другой разработчик в цепочке) делаете что-то неправильно. Это означает, что транзакции к устройству хранения излишне мелкозернистые для вашей цели — вы явно готовы пропустить некоторые точки сохранения производительности, так как теперь вы дошли до крайности, чтобы саботировать их все — редко лучший компромисс. Кроме того, именно здесь, на рынке транзакций, где одни из самых больших преимуществ наличия SSD — любой приличный SSD собирается выходить за пределы этого мира по сравнению с тем, что может занять вращающийся диск (7200 об /мин = 120 Гц, если к ним обращается другое), не говоря уже о картах флэш-памяти, которые сильно различаются по этой метрике (не в последнюю очередь потому, что это компромисс с последовательной производительностью, с которой они оцениваются, например, рейтинг класса SD-карты) , Поэтому будьте осторожны, разработчики с пылающими быстрыми SSD-устройствами, чтобы не заставлять ваших пользователей использовать этот прецедент!

Хотите услышать смешную историю? Мой первый fsync урок: у меня была работа, которая регулярно включала «обновление» базы данных Sqlite (хранится в качестве тестовых таблиц) в постоянно меняющемся текущем формате. Рамка «обновления» будет запускать кучу сценариев, делая по крайней мере одну транзакцию для обновления одной базы данных. Конечно, я обновлял свои базы данных параллельно (8 параллельно, так как я был благословлен мощным 8-ядерным процессором). Но, как я узнал, ускорения распараллеливания не было (скорее небольшой hit )потому что процесс был полностью связан с IO. Смешно, обертывая инфраструктуру обновления в скрипте, который скопировал каждую базу данных в /dev/shm , обновил ее там и скопировал обратно на диск, как в 100 раз быстрее (все еще с 8 параллельно). В качестве бонуса, ПК был годным к употреблению при обновлении баз данных.

Где tmpfs соответствует

Правильное использование tmpfs заключается в том, чтобы избежать ненужной записи летучих данных. Эффективное отключение writeback , например установка /proc/sys/vm/dirty_writeback_centisecs на бесконечность в обычной файловой системе.

Это очень мало связано с производительностью, и в противном случае это гораздо меньше, чем злоупотребление fsync: тайм-аут обратной записи определяет, насколько лениво содержимое диска обновляется после содержимого pagecache, а по умолчанию 5 секунд — это долгое время для компьютера — приложение может перезаписывать файл так часто, как требуется, в pagecache, но содержимое на диске обновляется только раз в 5 секунд. Если приложение не запустит его с помощью fsync. Подумайте, сколько раз приложение может выводить небольшой файл за это время, и вы видите, почему fsyncing каждый из них будет гораздо более серьезной проблемой.

Какие tmpfs не могут помочь вам с

  • Прочитайте производительность. Если ваши данные горячие (что лучше, если вы считаете сохранение в tmpfs), вы все равно попадете в pagecache. Разница заключается в том, что не ударяйте pagecache; если это так, перейдите к разделу «Где tmpfs sux» ниже.
  • Кратко проживающие файлы. Они могут прожить всю свою жизнь в pagecache (как грязные страницы ), прежде чем они будут выписаны. Если вы не принудительно выполняете его с помощью fsync , конечно.

Где tmpfs sux

Сохранение холодных данных. У вас может возникнуть соблазн подумать, что работа с файлами вне свопа так же эффективна, как и обычная файловая система, но есть несколько причин, почему это не так:

  • Простейшая причина: нет ничего, что современные устройства хранения (будь то жесткие диски или флэш-файлы) любят больше, чем чтение довольно последовательных файлов, аккуратно организованных надлежащей файловой системой. Переключение в блоки 4KiB вряд ли улучшится.
  • Скрытая стоимость: замена out . Страницы Tmpfs dirty — они должны быть записаны где-нибудь (чтобы поменяться), чтобы быть выселенными из pagecache, в отличие от файлов clean , которые можно мгновенно отбросить. Это лишний штраф за запись на все остальное, что конкурирует за память — влияет на что-то еще в разное время, чем на использование этих страниц tmpfs.

Хорошо, вот реальность.

Оба tmpfs и нормальная файловая система представляют собой кеш памяти на диске.

tmpfs использует память и swapspace, поскольку она поддерживает хранилище, в файловой системе используется определенная область диска, и не ограничено в размерах файловой системы, вполне возможно, что на машине с размером меньше GB если у вас достаточно swappace.

Разница заключается в том, когда данные записываются на диск. Для tmpfs данные записываются ТОЛЬКО, когда память становится слишком полной или данные вряд ли будут использоваться в ближайшее время. Большинство обычных файловых систем Linux OTOH всегда имеют более или менее согласованный набор данных на диске, поэтому, если пользователь вытаскивает вилку, они не теряют все.

Читайте также:  Почему нет windows 9 айфон 9

Лично я привык к наличию операционных систем, которые не вылетают из строя, и систем ИБП (например, батарей для ноутбуков), поэтому я думаю, что файловые системы ext2 /3 слишком параноидальные с интервалом 5-10 секунд контрольной точки. Файловая система ext4 лучше с 10-минутной контрольной точкой, за исключением того, что она обрабатывает данные пользователя как второй класс и не защищает ее. (ext3 — это то же самое, но вы не заметили его из-за 5-секундной контрольной точки)

Эта частая контрольная точка означает, что ненужные данные постоянно записываются на диск, даже для /tmp.

Итак, в результате вам нужно создать пространство подкачки так же сильно, как вам нужно /tmp (даже если вам нужно создать файл подкачки), и использовать это пространство для монтирования tmpfs требуемого размера на /tmp.

НИКОГДА не используйте /dev /shm.

Если вы используете его для очень маленьких (возможно, mmap’d) IPC-файлов, и вы уверены, что он существует (это не стандарт), и у машины более чем достаточно памяти + swap.

Используйте /tmp /для временных файлов. Используйте /dev /shm /, если вам нужна общая память (т. Е. Межпроцессная связь через файлы).

Вы можете полагаться на /tmp /там, но /dev /shm /является относительно недавней версией Linux.

/dev /shm используется для общих драйверов и программ для отдельных виртуальных систем памяти.

Если вы создаете программу, требующую кучи виртуальной памяти, которая должна быть сопоставлена ​​с виртуальной памятью. Это удваивается, поэтому, если вам нужно несколько процессов или потоков, чтобы иметь возможность безопасного доступа к этой памяти.

Дело в том, что только потому, что драйвер использует для него специальную версию tmpfs, не означает, что вы должны использовать его как общий раздел tmpfs. Вместо этого вам нужно просто создать другой раздел tmpfs, если вы хотите его для своего временного каталога.

В PERL, имеющем минимум 8 ГБ на любой машине (все работает под управлением Linux Mint), я считаю, что это хорошая привычка делать сложные алгоритмы на основе DB_File (структура данных в файле) с миллионами чтения и записи, используя /DEV /шй

В других языках, не имеющих повсюду, чтобы избежать запусков и остановок в сетевой передаче (работая локально на файле, который находится на сервере в атмосфере клиент-сервер), используя пакетный файл некоторого типа, я скопирует весь файл (300-900 МБ) сразу в /dev /shm, запустит программу с выходом в /dev /shm, запишет результаты на сервер и удалит из /dev /shm

Естественно, если бы у меня было меньше ОЗУ, я бы этого не делал. Обычно файловая система in-memory /dev /shm читается как размер, равный половине вашей свободной RAM. Однако обычное использование ОЗУ является постоянным. Таким образом, вы действительно не могли сделать это на устройстве с 2 ГБ или меньше. Чтобы перефразировать гиперболу, в ОЗУ часто бывают вещи, которые даже система не сообщает хорошо.

Источник

What Is /dev/shm And Its Practical Usage

/dev/shm is nothing but implementation of traditional shared memory concept. It is an efficient means of passing data between programs. One program will create a memory portion, which other processes (if permitted) can access. This will result into speeding up things on Linux.

shm / shmfs is also known as tmpfs, which is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device.

If you type the mount command you will see /dev/shm as a tempfs file system. Therefore, it is a file system, which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. By default almost all Linux distros configured to use /dev/shm:
$ df -h
Sample outputs:

Nevertheless, where can I use /dev/shm?

You can use /dev/shm to improve the performance of application software such as Oracle or overall Linux system performance. On heavily loaded system, it can make tons of difference. For example VMware workstation/server can be optimized to improve your Linux host’s performance (i.e. improve the performance of your virtual machines).

In this example, remount /dev/shm with 8G size as follows:
# mount -o remount,size=8G /dev/shm
To be frank, if you have more than 2GB RAM + multiple Virtual machines, this hack always improves performance. In this example, you will give you tmpfs instance on /disk2/tmpfs which can allocate 5GB RAM/SWAP in 5K inodes and it is only accessible by root:
# mount -t tmpfs -o size=5G,nr_inodes=5k,mode=700 tmpfs /disk2/tmpfs
Where,

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

  • -o opt1,opt2 : Pass various options with a -o flag followed by a comma separated string of options. In this examples, I used the following options:
    • remount : Attempt to remount an already-mounted filesystem. In this example, remount the system and increase its size.
    • size=8G or size=5G : Override default maximum size of the /dev/shm filesystem. he size is given in bytes, and rounded up to entire pages. The default is half of the memory. The size parameter also accepts a suffix % to limit this tmpfs instance to that percentage of your pysical RAM: the default, when neither size nor nr_blocks is specified, is size=50%. In this example it is set to 8GiB or 5GiB. The tmpfs mount options for sizing ( size, nr_blocks, and nr_inodes) accept a suffix k, m or g for Ki, Mi, Gi (binary kilo, mega and giga) and can be changed on remount.
    • nr_inodes=5k : The maximum number of inodes for this instance. The default is half of the number of your physical RAM pages, or (on a machine with highmem) the number of lowmem RAM pages, whichever is the lower.
    • mode=700 : Set initial permissions of the root directory.
    • tmpfs : Tmpfs is a file system which keeps all files in virtual memory.

How do I restrict or modify size of /dev/shm permanently?

You need to add or modify entry in /etc/fstab file so that system can read it after the reboot. Edit, /etc/fstab as a root user, enter:
# vi /etc/fstab
Append or modify /dev/shm entry as follows to set size to 8G

Save and close the file. For the changes to take effect immediately remount /dev/shm:
# mount -o remount /dev/shm
Verify the same:
# df -h

Recommend readings:

  • See man pages of mount regarding tmpfs options.
  • Details regarding tmpfs is available in /usr/share/doc/kernel-doc-/Documentation/filesystems/tmpfs.txt file.

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

Very good Description.

I want to know the concept of /dev/shm in FreeBSD.

Read up the md(4) manual page. To get the equivalent of Linux tmpfs, use the “swap” kind of md.

(To get the equivalent of Linux “ramdisk”, use the “malloc” kind instead.)

I cannot see where allocating an 8G ram disk on a machine with 8G of physical ram is a good thing. The OS will start swapping out the ram disk pages long before you fill it up, slowing the whole system to a crawl.

I have a 32G PC, with Xenial, look this:

tmpfs 16G 241M 16G 2% /dev/shm
tmpfs 16G 0 16G 0% /sys/fs/cgroup

Soon as I BOOT my machine, 100% of RAM is being used!! WTF is this? LOLOL

I you have 32G add 8G for virtual machine. I’m not asking to allocate all ram.

I don’t quite understand why u need the tmpfs thing – if u have that much of memory, just write direct to memory, why set up swapspace and then write to swapspace via tmpfs?

Similarly question for /dev/shm?

Is it because of 4GB limit for memory – in 32bit OS scenario?

Data written to a regular filesystem — one, that must survive a reboot — must be flushed to the actual storage eventually (and it better be soon).

A number of use-cases don’t need that sort of persistence-guarantee — for example, the PID-files lose meaning after a reboot anyway.

For another example, Amazon-hosted virtual machines get access to “ephemeral” storage — fast (SSD-backed) “disks”, which are wiped-out on every reboot. The best way to use them is by making them swap and mounting a filesystem (such as /tmp) over most of this new capacity.

Peter you can’t always write direct to memory, for example I have a cgi program I want to load very fast placing it in tmpfs will permit that. If I simply place the file on the disk and ‘hope’ the disk cache caches it then it may be swapped out during times of high disk activity. by placing it in shared memory it will stay put. until of course the next reboot
DC

I am a new to linux
After reading the discussion of this article i am
really confused

firstly, what is tmpfs and swap space? where they are stored?
second, if there are any difference how this will affect the performance of a system?
third, is there any method to allocate tmpfs or swap space for a particular program?

if my english is bad please forgive

/dev/shm is a good place for separate programs to communicate with each other. For example, one can implement a simple resource lock as a file in shared memory. It is fast because there is no disk access. It also frees you up from having to implement shared memory blocks yourself. You get (almost) all of the advantages of a shared memory block using stdio functions. It also means that simple bash scripts can use shared memory to communicate with each other.

As an example, I have an external piece of hardware which only one program at a time can communicate with. I want to log data from this device as often as possible, but also run an “assay” – ie. tell it to do a sequence of tasks. I have implemented this in a client/server mode where the “server” does all of the communication and the clients request actions. The data logger requests readings as often as it can and the assay controller requests the device to change states at the appropriate times. In order to avoid conflicts each client program must check a “lock file” in /dev/shm to see if the server is available. If it is, then the client writes it own process ID ($$ in bash) to the lock runs it request, and then releases the lock (don’t forget that step!) by writing 0 back to the lock so other clients know that the server is available again.

All of this _could_ be done with a “normal” file, but would be a bit slower.

Dear Susan,
Good explanation one thing more i wana add that when we install oracle in linux os if don’t have enough size in /dev/shm then we can not increase the size of sga at first stage we have to modify the size of this shm then we can alter memory_max_target parameter. thanks hope it was useful for every one.

I’m curious to know why when I executed “mount -o remount,size=8G /dev/shm” to increase the swap, the disk size of other partitions remain the same? Where is the additional 6 GB coming from if I already have 2G of /dev/shm ?

I have this same question. Where does the space come from ?

It’s not coming from disk space. You are grabbing available memory(RAM).

Something I see done that’s not commented on here is using this setup for single programs that use a lot of I/O during normal operation – like qmail (as long as your willing to loose mail in the queue if the server crashes or needs to reboot).

Not sure why you think making a ramdisk for swapping/paging is a good idea. Any page fault is still overhead. If you’re having heavy swapping or page faulting but have immense amounts of memory, the issue may be in the kernel parameters, not in reducing available memory to make a ramdisk.

Oracle uses large /dev/shm to improve communication between processes.
If your /dev/shm is not large enough Oracle will not install, worse will most likely
crash.

So is /dev/shm effectivly a ramdisk? but using virtual memory?

Yes and No
Yes /dev/shm is Ramdisk
No it doesn’t use virtual memory unless you run out of ram then the OS may swap to disk (virtual RAM). I don’t know enough to say for sure if this happens actually happens but it would be most likely.
If you run out of space on /dev/shm it would report an error like any other type of disk

It’s not quite the same as a ramdisk. A ramdisk is guaranteed to be in RAM, tmpfs may be swapped out. Depending what else is using RAM at the time it may or may not be faster that writing to a disk; it generally will be of course. Personally I run with very small /dev/shm as nothing I use uses it, as far as I can see.

The equivalent for the BSDs is mfs, but there’s no standard of having it in any particular location – as far as I know anyway.

Dear friend,
It’s really helpful and i can solve a giant oracle configuration problem easily with the above description..

I think It’s worth to mention to /dev/shm with nosuid,noexec options

Hello
It is corect this permision of ramdisk ?
drwxrwxrwt 2 root root 40 2010-05-24 15:53 ramdisk
This is a corect mount ?
# mount -t tmpfs /dev/shm /media/ramdisk
# mount -o remount,size=1756M /dev/shm
Why you use this ?
nr_inodes=5k,mode=700
Thank you !

I’m not finding this very helpful.

Like almost every manpage I’ve ever seen, this documentation assumes that you already know the stuff, and need a reminder of how to use it.

I’d like to use this–my system has 3 cpu’s and 4G memory, but runs erratically–freezing for anything from a fraction of a second to over a minute–particularly bothersome when viewing video from the hard drive, but it happens even when all I am doing is browsing.

While I understand the concept, (it is, after all an old idea,) this doesn’t help me apply it to my problem–if indeed it would help.

I’m still new to doing system admin on a linux box, though I have done many years of doing so on IBM mini’s and mainframes.

I’m old enough that my memory isn’t reliable, and my hands have tremors–making the use of the command line a pain in the (&O.

I know that I have a lot of study yet to do, but like all new systems, the amount of documentation is daunting, and much of it doesn’t help very much because it assumes a great many things–like all too much documentation written by programmers, it ignores the problems of those learning how to use things, and tends to be minimalistic and cryptic until you reach a threshold of knowledge (which I have yet to acquire.)

While reminder documentation is extremely useful, more details descriptions of what programs do and how they do it seem to me to be needed.

In general I’ve found that things which are used daily are over-documented, and things used rarely are massively under-documented. And programmers writing their own documentation are extremely likely to write only the most obscure parts of the tool instructions…because they are already intimately familiar with the main functions.

This is the kind of thing that leads to the extremely useless error messages generated by Windoze (Or an old database program I used once that gave only 4-digit error codes, all of which seemed to map to “call tech support,” bad enough, but the company no longer existed….

Am I alone in this perception?

Charles wrote:
“Am I alone in this perception?”

Hardly. Linux is a very unprofessional, badly written, poorly documented “OS”.

It’s only allure is the fact it’s free. If it weren’t free – nobody would use it. Unix was an interesting concept, but not good in practice. IBM’s DOS was able to destroy the Unix market almost immediately.

Linux is just a re-do of Unix – but worse. The original Linux source code was written by a novice: and as usual, everything flows “from the top”. That’s why we now have such horrible documentation, poorly-styled code without comments and hare-brained concepts such as /dev/shm. Everything is a Band-Aid fix for a gaping wound. There’s no consistency, no style, no rules. While some people may think these are features, the fact is these are what keeps Linux from winning over the bigger market.

The fact some people act like Linux is a product of nature shows how ignorant they are. It’s free. That’s why people use it. If Linus started charging for downloads it would lead to the end of Linux.

This is the most uneducated post I have read on the internet in all my life! My god, are you working for M$ or is this mr gates himself.

XSeSiV you are right, if this guy is not gates himself s a complete ignorant.

Fact, Linux rules the world of IT. The person responsible for the evolution of Linux basically won the “Nobel Prize” for technology. The poster Bob is probably a point and click monkey who needs a Vendor to tell him how to do his job.

“Linux is a very unprofessional, badly written, poorly documented “OS”.”
In order to make the above observation you have to know some of the major Enterprise level UNIX’s from the 90’s or even early 2000’s (AIX, Solaris, HP-UX.)
I worked on all of them, mostly on HP-UX. Linux would have to be born-again to come even 2% close the professionalism of HP-UX.
I switched to Linux 4 years ago, I’m not complaining, just sharing the facts.
The reason Linux became what it is today, is based on two facts; it was free, and it ran on x86.
Also it has to do with younger generation being more computer savvy. While older folks, shall we say were more like IBM types. Where you expected things to work, otherwise you did not put it out in the market.
Younger guys don’t mind spending hours and hours working with poor code, trying to make it work (remember they have been enticed by the fact it was free.)
But, that is the way world is. Progress. Would Google be what it is today, if it had to spend money on AIX and IBM hardware?
So my advice to older folks like me is to embrace change. If you don’t, change won’t stop, only you will be miserable.
One thing I noticed on working with Linux, expectations of the customers also match the level of professionalism of Linux. (I hope people get the last sentence)

completely wrong on so many levels.

linux is NOT an operating system. it is a Kernel. and in fact it is an industry standard kernel used is a vast array of operating systems used today. used in everything from client to server OS, all the way to mobile phones and even integrated devices.

The linux kernel is well documented, and is inherently credible.

The only reason we have some of the technology today is because of what was which the speed that technology has been evolving; left behind is the days of needing to elaborately document every function and command line flag:

What the new Linux ecosystem is, is a modular cornucopia of millions upon millions of code based on peoples hard work. We now have publicly accessible source code repositories, where things like crowd sourcing has increased the speed and rate of the evolution of technology exponentially, and to be honest, to put it simply, don’t fix something that isn’t broken.

This, coupled with communications and development tools, which again, are leaps and bounds ahead of their time compared to the tools of yesteryear, created a totally new global platform for a codependent software anatomy

instead of having one really nice OS with a few good tools, we have 25 good OS’s all working together to develop cross platform tools, which in turn scale the ENTIRE industry

That was a wonderful reply! You covered the topic mulch-dimensionally, concisely and comprehensively. I can’t help but think Bob would have asked “does it come in cornflower blue?”

Damned spell checkers! MULTI-DIMENSIONALLY, not MULCH! 🙂

lol thats why linux systems dominate over 60% of the global market share for servers

Charles — I don’t think you’re alone in that perception. However, with enough searching it seems I eventually find *somebody’s* site that gives wonderful insight for exactly what I need to know. The main thing is I don’t expect every blogger to write a follow-up to fill me in with what is assumed I know…I go and find out. Yes it takes time, but I think that’s the place everybody learning something new has to start :(… Unless you personally know an experienced Linux guru who volunteers time to mentor you.

I think as far as /dev/shm goes, the beauty of this being mounted like a normal file system is that you can write programs (and/or scripts) to use it like you would any other file system. If you have enough RAM available, it will be much more efficient than reading/writing a hard disk. If you’re not writing programs, then /dev/shm is of little consequence to you and does not do anything for you (unless you use a program which uses this). It really should be as if it does not even exist to the average user…but for a sysadmin, it’s good to be aware of it in the event you have a program (like Oracle) that is having strange problems. Then your awareness will lead you in the right direction when researching a solution.

As far as comments about using up RAM and slowing down the whole system…well you simply need to make good decisions about using it when it makes sense to use it, and not making your entire program use it. For example, you have to make the same decision about how much data you load into RAM at a time whether using /dev/shm or just by using a big buffer and passing a pointer between applications…lots of data uses lots of RAM and doesn’t matter whether it’s shm or somewhere else.

I’m speaking out my arse here, but I think mounting 8G shm on 8G RAM is perfectly fine as it’s referencing paged memory like any other program. There is a danger that if your program uses a significant amount, you can starve other programs in RAM by forcing them to swap…but if you’re in that situation, then the active program using SHM is going to use swap if you limit SHM to say, 2G or something…so either way you lose. In the end, don’t write programs that want to load 8G into RAM during runtime. Only load things into RAM if you need to use them right away. When you’re done using it, then free it.

Hello there,
no Gentoo user here? So just my addon, shm worked like charm if you do -j3 ore more compiling with gcc, it takes under Gentoo full advantage and speed up thinks greatly, while in daily use it seems to not be every used.
Put i really would not suggest to use more than half of the memory for shm, even its used by the kernel dynamically by the need, if you have something fucked up in any service running and your shm is filling up the main memory, everything goes into swap and kills the system via I/O flood ,….

Greeting from Beijing
xuedi

/dev/shm memory is not allocated until it is needed, as it would be silly to do so otherwise.

It is fairly typical to make the size == the RAM, and just pray you (almost) never actually reach that and start swapping like crazy.

/dev/shm is essentially a ramdisk, only pretending to be a file, and it might get swapped to disk when the going gets tough. You can survive a page fault or two now and then. You can’t survive constant thrashing of your swap.

Because it pretends to be a file and lives in RAM (mostly) it makes an execellent vehicle for program communication with locks etc as a “shared memory” substitute. It’s easy to use; It lives in RAM (mostly); It is fault-tolerant (hitting swap if it has to); It’s fast

My RAM died last night. be careful if you do this stuff.

Источник

Читайте также:  Windows memory diagnostics tool сколько тестов всего
Оцените статью