Operating systems memory management: help understanding a question related to segmentation

There is this question in my textbook (Operating Systems: Internals and Design Principles by William Stallings):

Write the binary translation of the logical address 0011000000110011 under the following hypothetical memory management schemes, and explain your answer:

a. A paging system with a 512-address page size, using a page table in which the frame number happens to be half of the page number.

b. A segmentation system with a 2K-address maximum segment size, using a segment table in which bases happen to be regularly placed at real addresses: segment# + 20 + offset + 4,096.

I am having trouble with understanding part b. I’m not a native English speaker. Initially, I assumed that “using a segment table in which bases happen to be regularly placed at real addresses” means that the segment number in the logical address is the number of the physical segment, but then I read this “segment# + 20 + offset + 4,096”, and I am not sure what to make of it. So does this mean that the base number in the segment table contains segment# (in the logical address) + 20 + offset (in the logical address) + 4,096?

Problem related to set partitioning

Let $ A_j=\{(a^i_j,b^i_j)~:~ 0 \leq i \leq n,\text{and } a^i_j,b^i_j \in \mathbb{Z}^+\}$

Given sets $ A_1,\ldots, A_{p}$ and a positive integer $ k$ , the problem is to check whether there exists one element $ (a^{i_j}_j,b^{i_j}_j)$ from each $ A_j$ such that $ \sum_{j}^{} a^{i_j}_j \geq k$ and $ \sum_{j}^{} b^{i_j}_j \geq k$ .

It looks like the problem is related to set partitioning problem, however, I am not sure how to get a reduction from set partitioning problem. Can someone help me to find the algorithm to solve this problem?

Is Levenshtein distance related to largest common subsequence?

I don’t have proof but i have gut feeling that , suppose s1 is string which needs to be converted to s2 then we can keep the largest common subsequence in s1 as it is and edit distance is number of elements we need to replace to add .

For example : s1 = "adjsjvnejnv"               s2 = "djpppne"  

Here LCS is “djne” , now we need to remove 3 element string “jnv” at right side of “djne” ,we can replace “sjv” with “ppp” in s1 and and we can delete “a” from s1. so total edit distance is 3+3+1 = 7 .

Idea is to replace or delete elements inbetween the elements of LCS and add or remove elements from right and left part of LCS .

I am not able to prove it . Can someone provide counterexample or proof ?

RPI cluster performance related to network performance

I’m writing my thesis and i have built a RPI cluster, containing 10 nodes which consists of RPI model 3b. I’ve them connected to two gigabit switches. I don’t know the CAT of the cables. They are not connected to the Internet, they just live in their private network.

Further more, i’ve calculated the theoretical performance by the formula:

number of cores * average frequency * 16 FLOPs/cycle = x GFLOPS (Got the formula from https://www.slothparadise.com/how-to-run-hpl-linpack-across-nodes/ )

after i applied it, it turns out i should have 76,8 GFLOPS in theory assuming that the source is relaiable and correct. When i benchmark it using HPL 2.1 i’ve only reached little about 7 GFLOPS at best when trying out various variations.

Now to my question: i’ve read up on the RPI model, and it says it only have 10/100 Ethernet. Is that the source of my problem? Seeing i get out GFLOPS from a node, but the network transportation is much less then Gigabit speed which would mean 76,8 GFLOPS * 0,1 Gigabit/second = 7,68 GFLOPS (in theory). Or am i way off the tracks in my thinking?

I really appriciate any help, so i can know if i have to keep working on the configuration for the benchmarking or if i can move on. Also, i’m sorry if i have posted in the wrong place.

Stay safe out there!

Should I put HR system and various business related systems under SSO?

We are building several systems for businesses, like employees schedule management and sharing, customer management and recently we are building HR System. We have put Schedule management and customer/contacts management application under SSO. Is it safe and meaningful to put HR System also under the same SSO system?

“X-Original-URL” and “X-Rewrite-URL” Related Vulnerabilities

I am going through the Burpsuite Academy Training on Access Control and I came across a section I still don’t fully understand. In their reading, they explain:

Some application frameworks support various non-standard HTTP headers that can be used to override the URL in the original request, such as X-Original-URL and X-Rewrite-URL. If a web site uses rigorous front-end controls to restrict access based on URL, but the application allows the URL to be overridden via a request header, then it might be possible to bypass the access controls using a request like the following:

POST / HTTP/1.1 X-Original-URL: /admin/deleteUser

In the following lab you could modify the HTTP request so that you can access a restricted /admin page by changing the header to set the GET request to “/” and then adding X-Original-URL: /admin as a new line.

I can’t find any documentation on either of these two headers. What do they do? And why does this vulnerability work? Is this a niche exploit, or something that might existing on many servers?

$O(n)$ algorithm related to contiguous subsequences

I’m given an array $ A$ with $ n$ integers. I need to find total contiguous subsequences (aka subarrays) such that the product of all the elements in that subarray can be represented as the difference of squares of two integers.

Now, we know that any integer can be represented as the difference of squares of two integers if the remainder obtained after division by $ 4$ is not $ 2$ .
Right now, I have a $ O(n^2)$ algorithm with me, where for each element $ A[i]$ , I visit all the elements from $ i-1$ to $ 0$ in that order and check if the remainder is $ 2$ .
Any hints on how to proceed for an $ O(n)$ algorithm?

Some Questions related to Linear programming

I have some question related to the Linear Programming problem :

1) If we have an objective function that needs to be maximized and let the feasible region be unbounded such that there is no finite optimum solution. My question is what is the meaning of “finite” here ?

2) If we need to solve LP using the simplex method , we need to transform any constrain that is written as an inequality equation to equality equation using the addition of the slack variables , so my question is by doing this modification did we change the problem ? I mean that we have added an extra variable so I think that we have created a new constraint ?

3) Also to solve the LP using simplex method , we need to have a maximization problem , so if we have to minimize an objective function , in this case to transform it to a maximization problem all we need to do is to negate the coefficients ? for example we need to minimize 3x+y=2 this is equivalent to maximizing -3x-y=2 ?

How to check if an opened page is a WC related page?

I need to detect all the WC related pages ( products, single product, checkout, etc… ) in a website.

I’ve added the wp action in the functions.php and tried to do it using is_shop() function but it doesn’t work. Here is the code with which I’ve tried to achieve this

add_action('wp', 'page_loaded');  function page_loaded() {    if (is_shop()) {       // Some code here    } } 

So, is there any way to achieve this?