Saturday, May 8, 2021

(C++): Difference between angle bracket < > and double quotes “ ” while including header files in C?

From stackoverflow:
It's compiler dependent. That said, in general using " prioritizes headers in the current working directory over system headers. <> usually is used for system headers. From to the spec (Section 6.10.2):


WiFi: What is phy restart? Why is it important in dense RF environments?

 Phy restart on radio drivers typically means if the hardware (radio) is able to sync to the preamble of a packet which has a stronger signal strength while it is already in the process of decoding a packet.

This is typically useful in noisy environments to achieve a "capture effect", where the stronger packet is finally decoded at the rx. radio. If the radio does not support PHY restart then typically such a reception would result in a collision on the rx-side at the radio.

Friday, May 7, 2021

Linux: What does IRQ save do in Linux?

 ExcerptUse local_irq_save to disable interrupts on the local processor and remember their previous state. The flags can be passed to local_irq_restore to restore the previous interrupt state.

void local_irq_save(unsigned long flags);
void local_irq_restore(unsigned long flags);

The spinlock version will disable interrupts on all the cores*

Thursday, May 6, 2021

Wireless: Difference between WiMAX and LTE Physical and MAC layers

This is an old post based on excerpts I read from the web. Adding it back.

This post will cover the technological differences between these two technologies and contains a brief bullet point description as to why LTE took off and WiMAX did not:

Slot times: LTE uses much smaller slot times - 1ms as opposed to 4ms which gives much worse delay performance with multiple users and does not scale just as well.

Uplink modulation: LTE introduced SC-FDMA which dramatically improved uplink performance for cellular systems. This modulation technique combines the advantages of low peak to average ratio of traditional systems (such as GSM) and multipath resistance of newer modulation schemes (such as OFDM). SC-FDMA also provides savings for the mobile users (on their uplink).

Timing: WiMAX was the first to start off. Hence most of the experiments were performed on this and LTE could learn from their experience and MISTAKES. WiMAX was initially designed for fixed systems rather than mobile systems and they were not able to adapt well for usage with cellular providers.

Other non MAC/PHY differences:

WiMAX is based on IEEE standards (specifically, the 802.16 family), and then managed by the WiMAX Forum. LTE is defined by 3GPP.  

WiMAX was originally designed for fixed networks and has gradually evolved into a mobile network. But this has resulted in some changes not being  made correctly. LTE was designed as a mobile network from the first day. This particularly impacts the power at the receiver (handhelds). WiMAX handhelds are slated to consume more power as compared to LTE.

Wednesday, May 5, 2021

Linux: What is function cloning? Name.clone.XX seen in crash or symbols?

 Excerpt from an online post:

In the case of the gcc compiler, it make a copy of a function with some modifications for faster execution.For example, if the compiler discovers that a function is called many different times with the same couple of initial parameters, then it may clone the function to produce a version which takes fewer parameters, and then change all the invoking functions to call the cloned function named as fn-name.clone instead.

Also found this from another post:
"Another example is that a compiler may make several clones of a function and compile them tuned for different microarchitectures, and then arrange for the appropriate one to be used at runtime based on some sort of CPU test."

Monday, May 3, 2021

Linux: Why do we need an executable stack with nested functions in GCC


  • The stack needs to be writable because the trampoline code is written on the stack which needs to be executed (to jump to the nested function). 
A nested function has no linkage by itself. So the trampoline code actually ensures two things:
  1. The outer () functions stack frame is available in the nested function
  2. Jump and execute code from the nested function.
Some other notes:
  • Nested functions are not a part of ANSI C, however, they are part of Gnu C.
  • The only reason nested functions are possibly useful because they use common stack variables.