zsh-users
 help / color / mirror / code / Atom feed
* ZSH "killing" sdcard/flash memory...
@ 2014-12-19  5:24 meino.cramer
  2014-12-19  6:15 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: meino.cramer @ 2014-12-19  5:24 UTC (permalink / raw)
  To: zsh-users

Hi,

I setup an embedded system (http://www.acmesystems.it/arietta) with
Gentoo Linux and zsh (of course! :).

The "harddisk" of this system is a sdcard (flash memory).

The amount of write cycles to a flash memory is limited. 
Therefore one is interested in reducing unneccessary writes
to the filesystem.

I use ext4 (with journaling) with my Arietta G25 board, because
powerfailure is more likely (battery powered) than with other
systems.

BUT:
Logging /sys/fs/ext4/mmcblk0p2/session_write_kbytes shows that
there were a greater amount of writes, even if the system was
totally idle (I was logged in though, but doesn't touch the
keyboard).

I took me quite some time to figure out that the process "guilty" ;)
for that was....zsh! Or better: The history mechanism of zsh.

I temporarily switched off history writing and...no writes to the
fs anymore.

I think (read: I dont know for sure...:)) what happens is this:
The actual process, which do the physical updates to the filesystem
on the flash is call jbd2, which is the journal handling process
of the kernel.
Everytime something is happen to the filesystem this process keeps
the journals up to date.

The process, which triggers jbd2 "to do something" is the history
mechanism of zsh.

But I _NEED_ the history mechanism...I will get lost of it...or
I have to write a ***lot*** more scripts...so switching it off
is not a real alternative.

Long story...short questions:
What is it, what makes the history mechanism of zsh constantly
"doing something" (closing/opening, writing, time stamping,
etc...anything what is filesystem related) with the filesystem, even
if there is no commandline to record?

How can I switch that off without lossing the history mechanism
itsselg?

If it is "inside zsh" I would like to propose to make zsh more
embedded-system-friendly by takeing flash memories in account.

What do you think?

Best regards,
Meino





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ZSH "killing" sdcard/flash memory...
  2014-12-19  5:24 ZSH "killing" sdcard/flash memory meino.cramer
@ 2014-12-19  6:15 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2014-12-19  6:15 UTC (permalink / raw)
  To: zsh-users

On Dec 19,  6:24am, meino.cramer@gmx.de wrote:
}
} Long story...short questions:
} What is it, what makes the history mechanism of zsh constantly
} "doing something" (closing/opening, writing, time stamping,
} etc...anything what is filesystem related) with the filesystem, even
} if there is no commandline to record?

The shell should be blocked on read of standard input unless it is
actively reading a command.  Do you mean you're interacting with a
shell that's running on this embedded system?

Do you have something like strace you can connect to the shell with to
see what system calls it is making?

} How can I switch that off without lossing the history mechanism
} itsselg?

Make sure you don't have SHARE_HISTORY or INC_APPEND_HISTORY or
INC_APPEND_HISTORY_TIME set -- but even those I'd only expect to be
examining the history when the shell is actively doing something.

Zsh does create and delete a lock file every time it needs to examine
the history.  In a recent shell you can try HIST_FCNTL_LOCK to see if
that avoids the lock file creation.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-19  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19  5:24 ZSH "killing" sdcard/flash memory meino.cramer
2014-12-19  6:15 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).