operating-system

difference between message queue and shared memory?

两盒软妹~` 提交于 2020-06-09 08:29:27
问题 I read a lot of articles about differences between message queue and shared memory. But still not clear which one is good for achieving good performance. Like shared memory are suppose to be good over queues but that also has performance issue in case of synchronizing it. 回答1: Both shared memory and message queues can be used to exchange information between processes. The difference is in how they are used. Shared memory is exactly what you'd think: it's an area of storage that can be read

Will the functions and variables precede with an “_” when compiled using gcc?

谁说我不能喝 提交于 2020-06-08 05:52:48
问题 I am learning OS development in a Linux environment using GCC. I learnt in Bran's Kernel Development that all the functions and variable names in C when compiled precedes with an "_"(underscore) in its corresponding Assembly source file. But when I went through the assembly source of a compiled C program, I can't even find the "_main" function. I performed the following. cpp sample.c sample.i gcc -S sample.I 回答1: That was true in the early days. A given C function foo would show up as _foo in

Why are “Executable files” operating system dependent?

荒凉一梦 提交于 2020-06-07 09:21:08
问题 I understand that each CPU/architecture has it's own instruction set, therefore a program(binary) written for a specific CPU cannot run on another. But what i don't really understand is why an executable file (binary like .exe for instance) cannot run on Linux but can run on windows even on the very same machine. This is a basic question, and the answer i'm expecting is that .exe and other binary formats are probably not Raw machine instructions but they contain some data that is operating

Why are “Executable files” operating system dependent?

帅比萌擦擦* 提交于 2020-06-07 09:19:46
问题 I understand that each CPU/architecture has it's own instruction set, therefore a program(binary) written for a specific CPU cannot run on another. But what i don't really understand is why an executable file (binary like .exe for instance) cannot run on Linux but can run on windows even on the very same machine. This is a basic question, and the answer i'm expecting is that .exe and other binary formats are probably not Raw machine instructions but they contain some data that is operating

what is the difference between uuid4 and secrets token_bytes in python?

不羁岁月 提交于 2020-05-17 06:48:06
问题 Checked the cpython source code for both secrets and uuid4. Both seems to be using os.urandom. #uuid.py def uuid4(): """Generate a random UUID.""" return UUID(bytes=os.urandom(16), version=4) #secrets.py def token_bytes(nbytes=None): """Return a random byte string containing *nbytes* bytes. If *nbytes* is ``None`` or not supplied, a reasonable default is used. >>> token_bytes(16) #doctest:+SKIP b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b' """ if nbytes is None: nbytes = DEFAULT

Chinese Android Devices Killing Background Service

丶灬走出姿态 提交于 2020-05-14 09:06:18
问题 I am trying to run a background service in an android application. I have tried the standard way of doing it and a lot of other tweaks. The problem is that when the application is closed from recent apps, the service gets killed. This only happens in Chinese Android devices like Oppo, Vivo, Xiomi, etc. It works fine on all other brands. I have tried the following solutions. Over-riding the OnStartCommand() of activity to return START_STICKY . This still not re-starts activity after the

What is kthreadd process and children and how it is different from init and children

為{幸葍}努か 提交于 2020-05-09 19:01:08
问题 I wanted to know what is kthread and why it does not take any memory and has no open files. I wrote some code which will simply print the PID of the currently running processes in a parent child tree format along with some additional information like used VMZ, RSS, threads, openfiles. All the children of the PID 2 named kthreadd did not have the VmSize and VmRSS in the /proc/[pid]/status file. the /proc/[pid]/fd did not contain any open files. What are these processes, how they are different

pip upgrade OSError: [Errno:13] Permission Denied

我只是一个虾纸丫 提交于 2020-05-08 19:52:25
问题 I need to upgrade pip on my Ubuntu system but I am getting error: Collecting pip Using cached pip-9.0.1-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 8.1.2 Uninstalling pip-8.1.2: Successfully uninstalled pip-8.1.2 Rolling back uninstall of pip Exception: Traceback (most recent call last): File "/home/shivams334/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/home/shivams334/.local/lib

How can I check the bitness of my OS using Java?? (J2SE, not os.arch)

十年热恋 提交于 2020-04-18 12:34:18
问题 I'm developing a software application that checks what kind of software you have installed, but in order to do so, I must know if the OS is a 32 bit or a 64 bit OS. I tried System.getProperty("os.arch"); but then I read that this command only shows us the bitness of the JDK/JRE, not the OS itself. If you could tell me how to know wich OS is being used (Windows 7, Mac OS, Ubuntu, etc...) that would be simply awesome C: 回答1: System.getProperty("os.arch"); Should be available on all platforms,

Is there a way to scan a directory to see how many files of certain type there is?

为君一笑 提交于 2020-04-18 03:57:29
问题 So if I have a directory like below is there a way to scan how many files with a specific code in its name. For example if I want the number of files that start with 17042020 which would be 6 from the directory below? 1704202001-01.csv 1704202001-02.csv 1704202002-01.csv 1704202002-02.csv 1704202003-01.csv 1704202003-02.csv 001.png 002.pdf 003.docx 004.jpg 回答1: Use os to get a list with your files : import os list = os.listdir("path") for element in list: if yourconditions: print(element) 回答2