LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-01-2016, 03:55 AM   #16
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled

I mean it's a pretty big world there are more than 6 billion people and you guys just want to dismiss something that you don't think exists yet. So you're saying if some new technology came out to make ourselves immortal, you would just dismiss that and let yourself die because you don't believe that it exists????




I'm just asking for help on how to fill up my virtual memory space... This is NOT about anything else.

Last edited by Thirdeyematt; 09-01-2016 at 03:56 AM.
 
Old 09-01-2016, 04:18 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,777

Rep: Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304
so to help you: what have you really tried, where is your code, where did you stuck? Probably we can help you to improve your code to do something related to "fill up my virtual memory space".
From the other hand we did not say we don't believe, we told you we know it won't work. As I already told you the content of the virtual memory is stored on a hard disk. Virtual means that is no real RAM, but .... look at here: wiki virtual memory
The stored images, sounds, apps and anything just stored as bits, a huge amount of 1 and 0, like this: 100101010101010101.
You will not find images, sounds on the disks, just these 0s ans 1s. There are softwares to make these recognisable by humans, like music players or image viewers, without them they are only just bits.
Finally, the statement: " putting a file into virtual memory is technically being used by the computer" is incorrect. Putting a file into virtual memory means just copying those bits and bytes from here to there without using a music player or any other application. So during that process it won't be played, won't be interpreted as music at all...
 
Old 09-01-2016, 06:07 AM   #18
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
so you are another that thinks magic works?
 
Old 09-10-2016, 06:15 PM   #19
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled
Well the code is too slow... I do not believe Java will be able to fill up the virtual memory fast enough.

So how do I write a program that will be able to use tmpfs or ramfs to make the same temporary file over 20000 times all with different names?
 
Old 09-10-2016, 06:24 PM   #20
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Read the documentation on mount.
 
Old 09-10-2016, 06:57 PM   #21
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Virtual memory from a programmer perspective is when you allocate ram that doesn't exist. Most times this allocation succeeds (because of the compiler and language handling it behind the scenes), but it's basically ram to disk. We call this swap in the land of linux. Once you run out of both types of ram, the kernel protects itself by removing those things using resources. Not that this is the terminology that you're referencing. Or at least your understanding of it.
 
Old 09-14-2016, 06:40 PM   #22
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled
Ok so I know the coding to clear the virtual memory with tmpfs. Also, here is the website I found to store files into virtual memory with tmpfs:

https://www.howtoforge.com/storing-f...ory-with-tmpfs

I just am not sure how to put the file into virtual memory 100,000 times instead of once, I am having trouble finding online how to do this... Some sort of stack add. I will continue looking but maybe someone has an idea or know how I could write some sort of code to do this?
 
Old 09-14-2016, 06:58 PM   #23
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Bad luck it says
Quote:
This article shows how you can store files and directories in memory instead of on the hard drive [with tmpfs]
You don't use any actual swap on disk until you have made full use of any unused RAM.
I'd suppose you could call that RAM usage virtual memory?
 
Old 09-14-2016, 08:59 PM   #24
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You still don't know what you are doing. tmpfs uses swap.

and it will use swap when reading the same file multiple times as reading a file gets loaded into cache, and when cache starts to run low, it WILL page out the least recently used pages.

https://www.kernel.org/doc/Documenta...tems/tmpfs.txt
 
Old 09-15-2016, 02:35 AM   #25
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,777

Rep: Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304Reputation: 7304
technically you may create a filesystem on tmpfs, and mount into /ramdisk (for example).
Code:
mount -t tmpfs -o size=100M,mode=0755 tmpfs /ramdisk  # << change the size
You can use any size you want, for example the full size of your ram + swap + even more (you can try).
Now you have a filesystem, and you can put/copy your file into /ramdisk. You can copy it several times using different filenames, so you can have file1.dat, file2.dat, file1000.dat, .....(the number of copies depends on the size you specified). And they will be stored automatically in swap/virtual memory as soon as the real memory is full.

But again, "putting a file into virtual memory is technically being used by the computer" is incorrect.
That is something like: buying beer and putting the bottles into your kitchen does not mean the beer is in use.
 
Old 09-15-2016, 10:15 AM   #26
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
technically you may create a filesystem on tmpfs, and mount into /ramdisk (for example).
Code:
mount -t tmpfs -o size=100M,mode=0755 tmpfs /ramdisk  # << change the size
You can use any size you want, for example the full size of your ram + swap + even more (you can try).
Now you have a filesystem, and you can put/copy your file into /ramdisk. You can copy it several times using different filenames, so you can have file1.dat, file2.dat, file1000.dat, .....(the number of copies depends on the size you specified). And they will be stored automatically in swap/virtual memory as soon as the real memory is full.

But again, "putting a file into virtual memory is technically being used by the computer" is incorrect.
That is something like: buying beer and putting the bottles into your kitchen does not mean the beer is in use.
Thank you for your reply, I think that this is getting closer to finished. Ok... So I guess I didn't mean that the computer was using the virtual memory, I just meant that putting a file into virtual memory is exactly what I am trying to do... So if that is the code for putting a file into virtual memory...

How do I go about writing code that will change the file name of the file every time I add it to the virtual memory?
And then is there a way to write a code that will put/copy the file into virtual memory instead of having to hit paste 100k times?
 
Old 09-15-2016, 11:08 AM   #27
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
in bash?

$ for COUNT in {1..100000}; do cp FILE /location/FILE$COUNT; done

It's not rocket science, read a book, or man page, or learn the secrets of F1 (F3 on mainframes) or help.

or

$ for COUNT in {100001..200000}; do cp FILE /location/FILE$COUNT; done

If you want all the files to have the same number of digits without fancy padding logic.
 
Old 09-15-2016, 07:04 PM   #28
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thank you shadow!!! I believe it worked!!! . Does it need to be in bash for it to work, or can I run that command in terminal after I have installed bash?

The reason I say that is because I have tried installing bash and then when I double click the bash executable nothing happens?


Also, what is the code to clear out the virtual memory so I can put a new image file in?
 
Old 09-15-2016, 07:20 PM   #29
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Read the manual.
 
Old 09-15-2016, 08:59 PM   #30
Thirdeyematt
Member
 
Registered: Aug 2016
Posts: 31

Original Poster
Rep: Reputation: Disabled
Well I took a look at the manual, I didn't see a cp command, does this have the function of the map file command without actually having to declare an array that the file is being mapped to?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] swap file, virtual memory Art McClure Slackware 2 04-08-2012 10:56 AM
Where to put Bash scripts written to run at various times to examine Alsa sound probs xologist Linux - Software 3 08-13-2008 10:09 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
Information for virtual memory file system peiwai Linux - Software 1 05-01-2006 12:09 PM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration