Sponsored Content
Full Discussion: Combining lists
Top Forums Shell Programming and Scripting Combining lists Post 303043048 by nezabudka on Thursday 16th of January 2020 08:13:16 AM
Old 01-16-2020
Yes, it's cool.
"${L2[i%lenL2]]}"
This algorithm can be organized even on "awk" or "bc" with a large size of values
Thanks @Scrutinizer
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question on lists

I'm fairly new to shell scripting and would like to know if what I am seeking to do is possible in shell. I'm trying to make a list of strings. The list will be looped through and each member of the list will be used to pass a parsing option to python. My script looks something like this: ... (3 Replies)
Discussion started by: Nacre
3 Replies

2. AIX

grep using lists?

I have a file that contain a list of files. How can I use grep to search the files in the list for a specific pattern? (2 Replies)
Discussion started by: bbbngowc
2 Replies

3. Shell Programming and Scripting

How to get the files lists

Hi All, Need the help in getting the file list which are generated for the time period. example if i want to get the list of file generated between 11 to 12 clock. i used the find command search the files with -cmin flag with -60. find /home/test/* -cmin -60 -type f -exec ls {} \; ... (2 Replies)
Discussion started by: nmadhuhb
2 Replies

4. Shell Programming and Scripting

Shell Script to Create non-duplicate lists from two lists

File_A contains Strings: a b c d File_B contains Strings: a c z Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below. Resultant... (7 Replies)
Discussion started by: mlv_99
7 Replies

5. Shell Programming and Scripting

Using foreach with two lists

Hi everybody, I'm trying to use a foreach command with two lists. The file.txt looks like this: var1: 100 200 300 var2: 3 6 9 I'm trying to use a foreach command to associate the two variables together. My script looks like this: #! /bin/tcsh set a=(`cat file.txt | grep 'var1' | cut -d... (8 Replies)
Discussion started by: SimonWhite
8 Replies

6. Shell Programming and Scripting

combining two lists

Hi, So I I received two lists for my merchandise and both are similar but differences do occur. I want to combine two lists that have similar names but I dont want the similar name to come up twice because I will end up purchasing two of those items. Heres an example below (file is massive). ... (1 Reply)
Discussion started by: kylle345
1 Replies

7. Shell Programming and Scripting

get the lists

I expert, I may cross post something similar but I dirtyed my quesion somehow to be clear in the thread #cat file1 88dee gcc: Grok for callconvention-hard to enable hard float a2ad2 eglibc: package mtrace separately 61487 python: bump PR of packages after update of distutils.bbclass... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

8. UNIX for Dummies Questions & Answers

Lists in awk

Hi togehter! I would like to write an awk script which prints the first column divided by the sum of the second column: So if this is my list 1 2 2 1 3 1 4 1 it should print a list like this: 1/5 2/5 3/5 4/5 My idea was to use END like this: (3 Replies)
Discussion started by: bjoern456
3 Replies

9. Shell Programming and Scripting

Issue with Lists

Hey guys, so I wrote this simple script. The first time I typed it all out, I had the issue where whatever choice I entered, it would simply tell me it was a "bad selection" aka the else output. I redid everything, and now no matter the choice, it does the backup option.. My brain hurts, and... (12 Replies)
Discussion started by: jakelawson44
12 Replies
VM_MAP_ENTRY_RESIZE_FREE(9)				   BSD Kernel Developer's Manual			       VM_MAP_ENTRY_RESIZE_FREE(9)

NAME
vm_map_entry_resize_free -- vm map free space algorithm SYNOPSIS
#include <sys/param.h> #include <vm/vm.h> #include <vm/vm_map.h> void vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t entry); DESCRIPTION
This manual page describes the vm_map_entry fields used in the VM map free space algorithm, how to maintain consistency of these variables, and the vm_map_entry_resize_free() function. VM map entries are organized as both a doubly-linked list (prev and next pointers) and as a binary search tree (left and right pointers). The search tree is organized as a Sleator and Tarjan splay tree, also known as a ``self-adjusting tree''. struct vm_map_entry { struct vm_map_entry *prev; struct vm_map_entry *next; struct vm_map_entry *left; struct vm_map_entry *right; vm_offset_t start; vm_offset_t end; vm_offset_t avail_ssize; vm_size_t adj_free; vm_size_t max_free; ... }; The free space algorithm adds two fields to struct vm_map_entry: adj_free and max_free. The adj_free field is the amount of free address space adjacent to and immediately following (higher address) the map entry. This field is unused in the map header. Note that adj_free depends on the linked list, not the splay tree and that adj_free can be computed as: entry->adj_free = (entry->next == &map->header ? map->max_offset : entry->next->start) - entry->end; The max_free field is the maximum amount of contiguous free space in the entry's subtree. Note that max_free depends on the splay tree, not the linked list and that max_free is computed by taking the maximum of its own adj_free and the max_free of its left and right subtrees. Again, max_free is unused in the map header. These fields allow for an O(log n) implementation of vm_map_findspace(). Using max_free, we can immediately test for a sufficiently large free region in an entire subtree. This makes it possible to find a first-fit free region of a given size in one pass down the tree, so O(log n) amortized using splay trees. When a free region changes size, we must update adj_free and max_free in the preceding map entry and propagate max_free up the tree. This is handled in vm_map_entry_link() and vm_map_entry_unlink() for the cases of inserting and deleting an entry. Note that vm_map_entry_link() updates both the new entry and the previous entry, and that vm_map_entry_unlink() updates the previous entry. Also note that max_free is not actually propagated up the tree. Instead, that entry is first splayed to the root and then the change is made there. This is a common tech- nique in splay trees and is also how map entries are linked and unlinked into the tree. The vm_map_entry_resize_free() function updates the free space variables in the given entry and propagates those values up the tree. This function should be called whenever a map entry is resized in-place, that is, by modifying its start or end values. Note that if you change end, then you should resize that entry, but if you change start, then you should resize the previous entry. The map must be locked before calling this function, and again, propagating max_free is performed by splaying that entry to the root. EXAMPLES
Consider adding a map entry with vm_map_insert(). ret = vm_map_insert(map, object, offset, start, end, prot, max_prot, cow); In this case, no further action is required to maintain consistency of the free space variables. The vm_map_insert() function calls vm_map_entry_link() which updates both the new entry and the previous entry. The same would be true for vm_map_delete() and for calling vm_map_entry_link() or vm_map_entry_unlink() directly. Now consider resizing an entry in-place without a call to vm_map_entry_link() or vm_map_entry_unlink(). entry->start = new_start; if (entry->prev != &map->header) vm_map_entry_resize_free(map, entry->prev); In this case, resetting start changes the amount of free space following the previous entry, so we use vm_map_entry_resize_free() to update the previous entry. Finally, suppose we change an entry's end address. entry->end = new_end; vm_map_entry_resize_free(map, entry); Here, we call vm_map_entry_resize_free() on the entry itself. SEE ALSO
vm_map(9), vm_map_findspace(9) Daniel D. Sleator and Robert E. Tarjan, "Self-Adjusting Binary Search Trees", JACM, vol. 32(3), pp. 652-686, July 1985. HISTORY
Splay trees were added to the VM map in FreeBSD 5.0, and the O(log n) tree-based free space algorithm was added in FreeBSD 5.3. AUTHORS
The tree-based free space algorithm and this manual page were written by Mark W. Krentel <krentel@dreamscape.com>. BSD
August 17, 2004 BSD
All times are GMT -4. The time now is 05:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy